QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#873078#8302. Incoming AsteroidslarryyuWA 87ms25832kbC++201.3kb2025-01-26 08:54:222025-01-26 08:54:29

Judging History

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

  • [2025-01-26 08:54:29]
  • 评测
  • 测评结果:WA
  • 用时:87ms
  • 内存:25832kb
  • [2025-01-26 08:54:22]
  • 提交

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;
	}
	sort(ans.begin(),ans.end());
	lst=ans.size();
	cout<<lst;
	if(ans.size()) cout<<" ";
	for(int i=0;i<ans.size();i++){
		cout<<ans[i];
		if(i!=ans.size()-1) cout<<" ";
	}
	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;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
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 1 2

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 87ms
memory: 25832kb

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'