QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#425490#8302. Incoming AsteroidsDaiRuiChen007WA 18ms79636kbC++141.0kb2024-05-30 11:51:232024-05-30 11:51:25

Judging History

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

  • [2024-05-30 11:51:25]
  • 评测
  • 测评结果:WA
  • 用时:18ms
  • 内存:79636kb
  • [2024-05-30 11:51:23]
  • 提交

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 '