QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#425499 | #8302. Incoming Asteroids | DaiRuiChen007 | WA | 102ms | 97100kb | C++14 | 1.1kb | 2024-05-30 11:55:40 | 2024-05-30 11:55:41 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int MAXN=1e6+5;
ll lim[MAXN],up[MAXN],sum[MAXN];
vector <int> pos[MAXN];
set <array<ll,2>> f[MAXN];
signed main() {
int n,m=0,q,lst=0;
scanf("%d%d",&n,&q);
while(q--) {
int op;
scanf("%d",&op);
if(op==1) {
int k,c;
scanf("%d%d",&k,&c),k^=lst;
lim[++m]=k,pos[m].resize(c);
for(int &i:pos[m]) scanf("%d",&i),i^=lst,lim[m]+=sum[i];
up[m]=(lim[m]+c-1)/c;
for(int i:pos[m]) f[i].insert({up[m],m});
} else {
int u,w;
scanf("%d%d",&u,&w),u^=lst,w^=lst;
sum[u]+=w;
vector <int> cur,ans;
for(auto x=f[u].begin(),it=f[u].lower_bound({sum[u]+1,0});x!=it;++x) cur.push_back((*x)[1]);
for(int i:cur) {
ll rem=lim[i];
for(int j:pos[i]) rem-=sum[j],f[j].erase({up[i],i});
if(rem<=0) ans.push_back(i);
else {
up[i]=(rem-1)/pos[i].size()+1;
for(int j:pos[i]) f[j].insert({up[i],i});
}
}
sort(ans.begin(),ans.end()),printf("%d",lst=ans.size());
for(int x:ans) printf(" %d",x); puts("");
}
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 7ms
memory: 79168kb
input:
3 5 1 5 3 1 2 3 2 2 1 1 2 2 1 2 2 3 1 2 1 3
output:
0 0 2 1 2
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 102ms
memory: 97100kb
input:
200000 200000 1 421386 1 122023 2 127573 97972 1 489180 1 197930 2 82505 59100 1 502097 3 91617 14193 139642 2 132931 74031 1 404862 1 36227 2 152826 8462 1 750072 2 51616 75416 2 1547 11479 1 255849 2 70036 41620 2 126414 17120 1 626334 3 97273 190595 174083 2 148803 132 1 407236 2 83898 5103 2 169...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
wrong answer 33068th lines differ - expected: '1 28189', found: '0'