QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#505197 | #9155. 集合 | Ecrade_ | 100 ✓ | 1010ms | 23920kb | C++14 | 1.2kb | 2024-08-04 21:43:33 | 2024-08-04 21:43:39 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
ll n,m,q,x,y,now = 1,a[200009][3],b[200009][3],c[200009];
ull ta,tb,ca[600009],cb[600009];
inline ll read(){
ll s = 0,w = 1;
char ch = getchar();
while (ch > '9' || ch < '0'){ if (ch == '-') w = -1; ch = getchar();}
while (ch <= '9' && ch >= '0') s = (s << 1) + (s << 3) + (ch ^ 48),ch = getchar();
return s * w;
}
ull qp(ull x,ull y){
ull a = 1,b = x;
while (y){
if (y & 1) a *= b;
b *= b,y >>= 1;
}
return a;
}
void add(ll x,bool opt){
for (ll i = 0;i < 3;i += 1){
ta -= qp(1000000007,ca[a[x][i]]),tb -= qp(1000000007,cb[b[x][i]]);
if (opt) ca[a[x][i]] += qp(998244353,x),cb[b[x][i]] += qp(998244353,x);
else ca[a[x][i]] -= qp(998244353,x),cb[b[x][i]] -= qp(998244353,x);
ta += qp(1000000007,ca[a[x][i]]),tb += qp(1000000007,cb[b[x][i]]);
}
}
int main(){
n = read(),m = read(),q = read();
for (ll i = 1;i <= n;i += 1) for (ll j = 0;j < 3;j += 1) a[i][j] = read();
for (ll i = 1;i <= n;i += 1) for (ll j = 0;j < 3;j += 1) b[i][j] = read();
for (ll i = 1;i <= n;i += 1){
add(i,1);
while (ta != tb) add(now ++,0);
c[i] = now;
}
while (q --) x = read(),y = read(),puts(c[y] <= x ? "Yes" : "No");
return 0;
}
詳細信息
Pretests
Pretest #1:
score: 5
Accepted
time: 1ms
memory: 7708kb
Pretest #2:
score: 5
Accepted
time: 1ms
memory: 7792kb
Pretest #3:
score: 5
Accepted
time: 1ms
memory: 7636kb
Pretest #4:
score: 5
Accepted
time: 1ms
memory: 7720kb
Pretest #5:
score: 5
Accepted
time: 1ms
memory: 7636kb
Pretest #6:
score: 5
Accepted
time: 0ms
memory: 7704kb
Pretest #7:
score: 5
Accepted
time: 0ms
memory: 7644kb
Pretest #8:
score: 5
Accepted
time: 0ms
memory: 7780kb
Pretest #9:
score: 5
Accepted
time: 10ms
memory: 7780kb
Pretest #10:
score: 5
Accepted
time: 10ms
memory: 7800kb
Pretest #11:
score: 5
Accepted
time: 937ms
memory: 14520kb
Pretest #12:
score: 5
Accepted
time: 919ms
memory: 14560kb
Pretest #13:
score: 5
Accepted
time: 10ms
memory: 7792kb
Pretest #14:
score: 5
Accepted
time: 6ms
memory: 7812kb
Pretest #15:
score: 5
Accepted
time: 52ms
memory: 7752kb
Pretest #16:
score: 5
Accepted
time: 47ms
memory: 7776kb
Pretest #17:
score: 5
Accepted
time: 92ms
memory: 9844kb
Pretest #18:
score: 5
Accepted
time: 81ms
memory: 8808kb
Pretest #19:
score: 5
Accepted
time: 1010ms
memory: 14584kb
Pretest #20:
score: 5
Accepted
time: 918ms
memory: 23920kb
Final Tests
Test #1:
score: 5
Accepted
time: 1ms
memory: 7664kb
Test #2:
score: 5
Accepted
time: 0ms
memory: 7644kb
Test #3:
score: 5
Accepted
time: 0ms
memory: 7776kb
Test #4:
score: 5
Accepted
time: 0ms
memory: 7640kb
Test #5:
score: 5
Accepted
time: 0ms
memory: 7640kb
Test #6:
score: 5
Accepted
time: 0ms
memory: 7700kb
Test #7:
score: 5
Accepted
time: 0ms
memory: 7716kb
Test #8:
score: 5
Accepted
time: 1ms
memory: 7676kb
Test #9:
score: 5
Accepted
time: 10ms
memory: 7740kb
Test #10:
score: 5
Accepted
time: 6ms
memory: 7788kb
Test #11:
score: 5
Accepted
time: 909ms
memory: 14640kb
Test #12:
score: 5
Accepted
time: 888ms
memory: 14636kb
Test #13:
score: 5
Accepted
time: 10ms
memory: 7732kb
Test #14:
score: 5
Accepted
time: 9ms
memory: 9872kb
Test #15:
score: 5
Accepted
time: 56ms
memory: 7808kb
Test #16:
score: 5
Accepted
time: 47ms
memory: 7760kb
Test #17:
score: 5
Accepted
time: 98ms
memory: 7828kb
Test #18:
score: 5
Accepted
time: 82ms
memory: 8740kb
Test #19:
score: 5
Accepted
time: 999ms
memory: 14836kb
Test #20:
score: 5
Accepted
time: 937ms
memory: 23916kb
Extra Test:
score: 0
Extra Test Passed