QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#490312 | #9155. 集合 | Eternatis | 100 ✓ | 184ms | 84056kb | C++14 | 2.2kb | 2024-07-25 14:27:44 | 2024-07-25 14:27:45 |
Judging History
answer
//¸¡ÓÎÖ®ÈË Ò²ÕõÔú²»ÒÑÖ´×Å´æÔÚÏÂÈ¥
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using namespace std;
#define N 1000010
#define int unsigned long long
#define db long double
#define pii pair<int,int>
#define st first
#define ed second
#define mkp make_pair
#define pb push_back
#define eps 1e-9
#define mod 998244353
#define mod2 1000000007
#define bs 13131
#define bs2 131
#define INF 0x3f3f3f3f3f3f3f3f
#define il inline
#define vi vector<int>
#define ins insert
#define umap unordered_map
#define uset unordered_set
#define R(x) x.begin(),x.end()
#define B(x) x.begin()
#define E(x) x.end()
#define lb lower_bound
#define ub upper_bound
#define vi vector<int>
il 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<<1)+(x<<3)+(ch^48);
ch=getchar();
}
return x*f;
}
int T=1,n,m,Q,k;
mt19937_64 rnd(chrono::system_clock::now().time_since_epoch().count());
int s[2][N][3];
vector<pii> q[N];
int msk;
il int shift(int x){
x^=msk;
x^=(x>>3);
x^=(x<<7);
x^=(x>>13);
x^=(x<<17);
x^=msk;
return x;
}
int ans[N];
int W[2];
int w[2][N];
int l,r;
il void Add(int p,int x,int i){
W[p]-=shift(w[p][x]);
w[p][x]+=shift(i);
W[p]+=shift(w[p][x]);
}
il void Del(int p,int x,int i){
W[p]-=shift(w[p][x]);
w[p][x]-=shift(i);
W[p]+=shift(w[p][x]);
}
il bool check(int p){
for(int i=0;i<3;i++)Add(0,s[0][p][i],p),Add(1,s[1][p][i],p);
if(W[0]==W[1])return 1;
for(int i=0;i<3;i++)Del(0,s[0][p][i],p),Del(1,s[1][p][i],p);
return 0;
}
il void del(int p){
for(int i=0;i<3;i++)Del(0,s[0][p][i],p),Del(1,s[1][p][i],p);
}
signed main(){
msk=rnd();
n=read(),m=read(),Q=read();
for(int p=0;p<2;p++)for(int i=1;i<=n;i++){
for(int j=0;j<3;j++)
s[p][i][j]=read();
W[p]+=shift(w[p][i]);
}
for(int i=1;i<=Q;i++){
int l=read(),r=read();
q[l].pb({r,i});
}
l=1,r=0;
while(l<=n){
while(check(r+1)&&r<n)r++;
for(auto x:q[l])ans[x.ed]=(x.st<=r);
del(l++);
}
for(int i=1;i<=Q;i++)
if(ans[i])puts("Yes");
else puts("No");
return 0;
}
詳細信息
Pretests
Pretest #1:
score: 5
Accepted
time: 0ms
memory: 32228kb
Pretest #2:
score: 5
Accepted
time: 0ms
memory: 32436kb
Pretest #3:
score: 5
Accepted
time: 0ms
memory: 32440kb
Pretest #4:
score: 5
Accepted
time: 4ms
memory: 32316kb
Pretest #5:
score: 5
Accepted
time: 7ms
memory: 34296kb
Pretest #6:
score: 5
Accepted
time: 2ms
memory: 32360kb
Pretest #7:
score: 5
Accepted
time: 0ms
memory: 32248kb
Pretest #8:
score: 5
Accepted
time: 3ms
memory: 32252kb
Pretest #9:
score: 5
Accepted
time: 15ms
memory: 38072kb
Pretest #10:
score: 5
Accepted
time: 7ms
memory: 38208kb
Pretest #11:
score: 5
Accepted
time: 48ms
memory: 49788kb
Pretest #12:
score: 5
Accepted
time: 45ms
memory: 47996kb
Pretest #13:
score: 5
Accepted
time: 0ms
memory: 32240kb
Pretest #14:
score: 5
Accepted
time: 0ms
memory: 32436kb
Pretest #15:
score: 5
Accepted
time: 74ms
memory: 60320kb
Pretest #16:
score: 5
Accepted
time: 56ms
memory: 62744kb
Pretest #17:
score: 5
Accepted
time: 3ms
memory: 34440kb
Pretest #18:
score: 5
Accepted
time: 6ms
memory: 33184kb
Pretest #19:
score: 5
Accepted
time: 184ms
memory: 74696kb
Pretest #20:
score: 5
Accepted
time: 176ms
memory: 84000kb
Final Tests
Test #1:
score: 5
Accepted
time: 0ms
memory: 34396kb
Test #2:
score: 5
Accepted
time: 5ms
memory: 32288kb
Test #3:
score: 5
Accepted
time: 2ms
memory: 34424kb
Test #4:
score: 5
Accepted
time: 2ms
memory: 32252kb
Test #5:
score: 5
Accepted
time: 3ms
memory: 32364kb
Test #6:
score: 5
Accepted
time: 0ms
memory: 34296kb
Test #7:
score: 5
Accepted
time: 3ms
memory: 34340kb
Test #8:
score: 5
Accepted
time: 0ms
memory: 34372kb
Test #9:
score: 5
Accepted
time: 14ms
memory: 38084kb
Test #10:
score: 5
Accepted
time: 18ms
memory: 36184kb
Test #11:
score: 5
Accepted
time: 55ms
memory: 47936kb
Test #12:
score: 5
Accepted
time: 53ms
memory: 47788kb
Test #13:
score: 5
Accepted
time: 0ms
memory: 34296kb
Test #14:
score: 5
Accepted
time: 7ms
memory: 32464kb
Test #15:
score: 5
Accepted
time: 65ms
memory: 60316kb
Test #16:
score: 5
Accepted
time: 65ms
memory: 60452kb
Test #17:
score: 5
Accepted
time: 3ms
memory: 36412kb
Test #18:
score: 5
Accepted
time: 3ms
memory: 35336kb
Test #19:
score: 5
Accepted
time: 164ms
memory: 74720kb
Test #20:
score: 5
Accepted
time: 181ms
memory: 84056kb
Extra Test:
score: 0
Extra Test Passed