QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#619143#8302. Incoming AsteroidsDarksideCoderWA 2ms18416kbC++142.0kb2024-10-07 13:16:142024-10-07 13:16:17

Judging History

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

  • [2024-10-07 13:16:17]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:18416kb
  • [2024-10-07 13:16:14]
  • 提交

answer

#include<bits/stdc++.h>
//#define Debug
using std::vector;
using std::pair;
#define int long long
#define fi first
#define se second
#define ll long long
#define pii pair<int,int>
template<typename T>
void Clear(T&x){T y;x.swap(y);}
template<typename... Args>
void Clear(Args&... args){
    (Clear(args), ...);//必须加括号
}
std::default_random_engine E(std::chrono::steady_clock().now().time_since_epoch().count());

const int MaxN=210000;
int ind,n,m,Val[MaxN],Le[MaxN],Po[MaxN][4],last;

std::set<pair<ll,ll>>S[MaxN];
int Py[MaxN];
vector<int>Ans,Tmp;

signed main(){
	#ifdef LOCAL
	freopen("In.txt","r",stdin);
	freopen("Out.txt","w",stdout);
	#endif
	scanf("%lld%lld",&n,&m);
	
		
	for(int i=1;i<=m;i++){
		int opt;
		scanf("%lld",&opt);
		if(opt==1){
			int id=++ind;
			scanf("%lld",&Val[id]);Val[id]=Val[id]^last;
			scanf("%lld",&Le[id]);
			for(int j=1;j<=Le[id];j++)
				scanf("%lld",&Po[id][j]),Po[id][j]=Po[id][j]^last;
			for(int j=1;j<=Le[id];j++){
				int kp=Val[id]/Le[id];
				if(j==1)S[Po[id][j]].insert({id,kp+Val[id]%Le[id]+Py[Po[id][j]]});
				else S[Po[id][j]].insert({id,kp+Py[Po[id][j]]});
			}
		}
		else{
			int po,val;
			scanf("%lld%lld",&po,&val);po^=last,val^=last;
			Py[po]+=val;
			Clear(Ans);
			Clear(Tmp);
			for(auto it=S[po].begin();it!=S[po].end();){
				auto k=*it;
				if(k.se>Py[po])break;
				it=S[po].erase(it);
				int id=k.fi;
				Val[id]-=val;
				for(int j=1;j<=Le[id];j++){
					if(Po[id][j]==po)continue;
					S[Po[id][j]].erase(S[Po[id][j]].lower_bound({id,0xcfcfcfcfcfcfcfcf}));
				}
				if(Val[id]<0)Ans.push_back(id);
				else Tmp.push_back(id);
			}
			for(auto id:Tmp){
				for(int j=1;j<=Le[id];j++){
					int kp=Val[id]/Le[id];
					if(j==1)S[Po[id][j]].insert({id,kp+Val[id]%Le[id]+Py[Po[id][j]]});
					else S[Po[id][j]].insert({id,kp+Py[Po[id][j]]});
				}
			}
			printf("%lld",last=Ans.size());
			std::sort(Ans.begin(),Ans.end());
			for(auto id:Ans)
				printf(" %lld",id);
			puts("");
		}
	}
	
	
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 18416kb

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

result:

wrong answer 3rd lines differ - expected: '2 1 2', found: '1 2'