QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#439440 | #8302. Incoming Asteroids | moyujiang | WA | 68ms | 26860kb | C++14 | 1.5kb | 2024-06-11 22:08:25 | 2024-06-11 22:08:26 |
Judging History
answer
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a),i##END=(b);i<=i##END;i++)
#define Rof(i,b,a) for(int i=(b),i##END=(a);i>=i##END;i--)
#define go(u) for(int i=head[u];i;i=nxt[i])
using namespace std;
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<<1)+(x<<3)+(ch^48);ch=getchar();}
return x*f;
}
const int N=2e5+10;
int n,m,lst,o[N][3],Tag[N][3];
int idx,Y[N],d[N];
struct node{
int id,val;
bool operator < (const node &x) const {
return val<x.val;
}
};
multiset<node> s[N];
int tag[N];
bool check(int id){
int y=0;For(i,0,2)y+=tag[o[id][i]]-Tag[id][i];
return y>=Y[id];
}
void upd(int id){
For(i,0,2)Y[id]-=tag[o[id][i]]-Tag[id][i],Tag[id][i]=tag[o[id][i]];
For(i,0,2)s[o[id][i]].insert((node){idx,Y[id]/3+1+tag[o[id][i]]});
}
signed main(){
n=read(),m=read();while(m--){
int op=read();
if(op==1){
int y=read()^lst,k=read();
Y[++idx]=y;
For(j,1,k){
int x=read()^lst;
o[idx][j-1]=x;
Tag[idx][j-1]=tag[x];
s[x].insert((node){idx,y/3+1+tag[x]});
}
}else{
int x=read()^lst,y=read()^lst;vector<int> ans;
tag[x]+=y;while(!s[x].empty()&&tag[x]>=s[x].begin()->val){
int id=s[x].begin()->id;s[x].erase(s[x].begin());
if(!d[id]){
if(check(id))d[id]=1,ans.push_back(id);
else upd(id);
}
}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: 0ms
memory: 13160kb
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: 68ms
memory: 26860kb
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 17620th lines differ - expected: '1 1386', found: '0'