当前位置:网站首页>(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;}
边栏推荐
- typescript23-元组
- How to write a high-quality digital good article recommendation
- The Flow Of Percona Toolkit pt-table-checksum
- 最新 955 不加班的公司名单
- typescript22-接口继承
- Excuse me, only primary key columns can be queried using sql in table storage. Does ots sql not support non-primary keys?
- 【愚公系列】2022年07月 Go教学课程 024-函数
- 万字逐行解析与实现Transformer,并进行德译英实战(二)
- 在沈自所的半年总结
- 智芯传感输液泵压力传感器 为精准智能控制注入科技“强心剂”
猜你喜欢
「以云为核,无感极速」顶象第五代验证码
MLP neural network, GRNN neural network, SVM neural network and deep learning neural network compare and identify human health and non-health data
typescript21 - Comparison of Interfaces and Type Aliases
基于STM32设计的UNO卡牌游戏(双人、多人对战)
typescript27 - what about enumeration types
typescript28-枚举类型的值以及数据枚举
Flink 1.13 (8) CDC
MySQL3
leetcode:126. Word Solitaire II
API设计笔记:pimpl技巧
随机推荐
Message Queuing Message Storage Design (Architecture Camp Module 8 Jobs)
请问shake数据库中想把源的db0的数据同步到目的db5,参数怎么设置呢?
解决ffmpeg使用screen-capture-recorder录屏,有屏幕缩放的情况下录不全的问题
Simulation of Active anti-islanding-AFD Active Anti-islanding Model Based on Simulink
Excel做题记录——整数规划优化模型
What is dynamic programming and what is the knapsack problem
MySQL3
"ArchSummit: The cry of the times, technical people can hear"
罗技鼠标体验记录
剑指 Offer 68 - II. 二叉树的最近公共祖先
7月编程排行榜来啦!这次有何新变化?
微软 Win10 照片磁贴后的又一“刺客”,谷歌 Chrome 浏览器将在新标签页展示用户照片
报错:AttributeError: module ‘matplotlib’ has no attribute ‘figure’
typescript21-接口和类型别名的对比
[kali-information collection] enumeration - DNS enumeration: DNSenum, fierce
typescript23-tuple
Typescript20 - interface
Mysql中的数据类型和运算符
TIM登陆时提示00001(TIM00001)
项目风险管理必备内容总结