QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#425490 | #8302. Incoming Asteroids | DaiRuiChen007 | WA | 18ms | 79636kb | C++14 | 1.0kb | 2024-05-30 11:51:23 | 2024-05-30 11:51:25 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int MAXN=1e6+5;
int lim[MAXN],up[MAXN],sum[MAXN];
vector <int> pos[MAXN];
set <array<int,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),up[m]=(k+c-1)/c;
for(int &i:pos[m]) scanf("%d",&i),i^=lst,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;
auto itr=f[u].lower_bound({sum[u]+1,0});
for(auto x=f[u].begin();x!=itr;++x) cur.push_back((*x)[1]);
for(int i:cur) {
int 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;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 18ms
memory: 79636kb
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:
wrong answer 1st lines differ - expected: '0', found: '0 '