QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#873074#8302. Incoming AsteroidslarryyuWA 3ms15976kbC++201.2kb2025-01-26 08:50:492025-01-26 08:50:49

Judging History

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

  • [2025-01-26 08:50:49]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:15976kb
  • [2025-01-26 08:50:49]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
int n,m,cnt,tot,lst;
int bel[600060],frm[600060],rst[200020],tag[200020];
priority_queue<pii,vector<pii>,greater<pii>> q[200020];
vector<int> v[200020],ans;
void add(){
	cnt++;
	int k;
	cin>>rst[cnt]>>k;
	rst[cnt]^=lst;
	for(int i=1;i<=k;i++){
		int x;
		cin>>x;
		x^=lst;
		q[x].push(pii{ceil(1.0*rst[cnt]/k),++tot});
		bel[tot]=cnt,v[cnt].push_back(tot),frm[tot]=x;
	}
}
void upd(int x){
	if(rst[x]<=0) return ;
	int sum=0;
	for(int i:v[x]) sum+=tag[frm[i]];
	rst[x]-=sum;
	if(rst[x]<=0) return ans.push_back(x),void();
	for(int i:v[x]){
		q[frm[i]].push(pii{tag[frm[i]]+ceil(1.0*rst[x]/v[x].size()),i});
	}
}
void upd(){
	int s,w;
	cin>>s>>w;
	s^=lst,w^=lst;
	tag[s]+=w;
	while(q[s].size()){
		pii x=q[s].top();
		if(x.first<=tag[s]) upd(bel[x.second]),q[s].pop();
		else break;
	}
	lst=ans.size();
	cout<<lst<<" ";
	for(int i:ans) cout<<i<<" ";
	cout<<'\n';
	ans.clear();
	// for(int i=1;i<=cnt;i++){
	// 	cout<<rst[cnt]<<" ";
	// }
	// cout<<'\n';
}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(nullptr);
	cin>>n>>m;
	while(m--){
		int op;
		cin>>op;
		if(op==1) add();
		else upd();
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 3ms
memory: 15976kb

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 2 1 

result:

wrong answer 1st lines differ - expected: '0', found: '0 '