当前位置:网站首页>(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 1191415411Sample output:
34417749The 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;} 边栏推荐
- How to promote new products online?
- MySQL4
- mysql中解决存储过程表名通过变量传递的方法
- 深圳某游戏研发公司给每个工位都装监控,网友:堪比坐牢!
- UE4 rays flashed from mouse position detection
- 【愚公系列】2022年07月 .NET架构班 085-微服务专题 Abp vNext微服务网关
- Immutable
- The kernel's handling of the device tree
- Excel record of integer programming optimization model to solve the problem
- 产品经理访谈 | 第五代验证码的创新与背景
猜你喜欢

风险策略调优中重要的三步分析法

万字逐行解析与实现Transformer,并进行德译英实战(一)

Message queue MySQL table for storing message data

Progressive Reconstruction of Visual Structure for Image Inpainting 论文笔记

MySQL3

56:第五章:开发admin管理服务:9:开发【文件上传到,MongoDB的GridFS中,接口】;(把文件上传到GridFS的SOP)

TypeScript simplifies running ts-node

How to promote new products online?

基于Arduino制作非接触式测温仪

MySQL-DML语言-数据库操作语言-insert-update-delete-truncate
随机推荐
typescript28 - value of enumeration type and data enumeration
lambda
lambda
万字逐行解析与实现Transformer,并进行德译英实战(二)
IJCAI2022 | Hybrid Probabilistic Reasoning with Algebraic and Logical Constraints
button remove black frame
Passive anti-islanding-UVP/OVP and UFP/OFP passive anti-islanding model simulation based on simulink
Character encoding and floating point calculation precision loss problem
High Numbers | 【Re-integration】Line Area Score 880 Examples
怀念故乡的面条
TypeScript simplifies running ts-node
程序员代码面试指南 CD15 生成窗口最大值数组
typescript28-枚举类型的值以及数据枚举
初识shell脚本
报错:AttributeError: module ‘matplotlib’ has no attribute ‘figure’
李迟2022年7月工作生活总结
Make your Lottie support word wrapping in text fields
Message queue design based on mysql
今日睡眠质量记录68分
typescript23-tuple