当前位置:网站首页>(2022 Nioke Duo School IV) D-Jobs (Easy Version) (3D prefix or)
(2022 Nioke Duo School IV) D-Jobs (Easy Version) (3D prefix or)
2022-08-01 04:50:00 【AC__dream】
Title:
Sample input:
3 52 1 1 2 2 1 23 1 3 2 2 3 1 2 3 32 2 3 1 3 2 1191415411
Sample output:
34417749
The meaning of the question: There are n companies, and the i-th company has mi jobs. Each job has numerical requirements for three abilities, and all three abilities must meet the standards to be qualified for the job.As long as a person is competent for any job in a company, he can enter the company.
Q times of inquiries, each time a triplet, representing the values of a person's three abilities, ask how many companies this person can go to work, and force online.
We can't do the prefix sum for every company because 10*400*400*400 will definitely time out, since we just need to know if we canCompetent for a certain job of a certain company, not all jobs, and we want to store the information of multiple companies, so we only need to maintain it with binary, for the t th companyWe use the t-th bit to maintain this information, so that we can make complementary interference between companies.Then it can be directly O(1) query.
Here is the code:
#include#include#include#include#include#include using namespace std;const int N=401,mod=998244353;int f[N][N][N],s[2000005];int lastans=0,seed;inline int read(){int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}return x*f;}int main(){int n,m;n=read();m=read();for(int i=1;i<=n;i++){int t;t=read();for(int j=1;j<=t;j++){int a,b,c;a=read(),b=read(),c=read();f[a][b][c]|=(1<u(1,400);std::mt19937 rng(seed);s[0]=1;for(int i=1;i<=m;i++)s[i]=1ll*s[i-1]*seed%mod;long long anss = 0;for(int i=1;i<=m;i++){int IQ=(u(rng)^lastans)%400+1; // The IQ of the i-th friendint EQ=(u(rng)^lastans)%400+1; // The EQ of the i-th friendint AQ=(u(rng)^lastans)%400+1; // The AQ of the i-th friendlastans=0;for(int i=1;i<=n;i++)lastans+=f[IQ][EQ][AQ]>>i&1;anss = (anss+1ll*lastans*s[m-i]%mod)%mod;}printf("%lld\n", anss);return 0;}
边栏推荐
- JS new fun(); class and instance JS is based on object language Can only act as a class by writing constructors
- Input input box cursor automatically jumps to the last bug after the previous input
- 认真对待每一个时刻
- PMP 80个输入输出总结
- 项目风险管理必备内容总结
- 7月编程排行榜来啦!这次有何新变化?
- 剑指 Offer 68 - II. 二叉树的最近公共祖先
- PMP工具与技术总结
- PMP子过程定义总结
- 6-23漏洞利用-postgresql代码执行利用
猜你喜欢
Lawyer Interpretation | Guns or Roses?Talking about Metaverse Interoperability from the Battle of Big Manufacturers
Flink 1.13 (8) CDC
typescript25 - type assertion
"ArchSummit: The cry of the times, technical people can hear"
2022-07-31: Given a graph with n points and m directed edges, you can use magic to turn directed edges into undirected edges, such as directed edges from A to B, with a weight of 7.After casting the m
typescript26-字面量类型
基于ProXmoX VE的虚拟化家庭服务器(篇一)—ProXmoX VE 安装及基础配置
Passive anti-islanding-UVP/OVP and UFP/OFP passive anti-islanding model simulation based on simulink
风险策略调优中重要的三步分析法
UE4 从鼠标位置射出射线检测
随机推荐
Message Queuing Message Storage Design (Architecture Camp Module 8 Jobs)
文件的异步读写
【愚公系列】2022年07月 Go教学课程 025-递归函数
MySQL4
The Principle Of Percona Toolkit Nibble Algorithm
What is a programming language
typescript19-对象可选参数
PMP子过程定义总结
PMP 项目质量管理
typescript25-类型断言
typescript26 - literal types
基于STM32设计的UNO卡牌游戏(双人、多人对战)
Excel做题记录——整数规划优化模型
MLP neural network, GRNN neural network, SVM neural network and deep learning neural network compare and identify human health and non-health data
罗技鼠标体验记录
Flink 1.13 (8) CDC
Pyspark Machine Learning: Vectors and Common Operations
初识shell脚本
万字逐行解析与实现Transformer,并进行德译英实战(三)
IJCAI2022 | Hybrid Probabilistic Reasoning with Algebraic and Logical Constraints