QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#425494#8302. Incoming AsteroidsDaiRuiChen007WA 123ms87832kbC++141.0kb2024-05-30 11:51:592024-05-30 11:52:00

Judging History

你现在查看的是最新测评结果

  • [2024-05-30 11:52:00]
  • 评测
  • 测评结果:WA
  • 用时:123ms
  • 内存:87832kb
  • [2024-05-30 11:51:59]
  • 提交

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;
}

详细

Test #1:

score: 100
Accepted
time: 14ms
memory: 74436kb

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: 123ms
memory: 87832kb

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 7787th lines differ - expected: '0', found: '1 3640'