QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#619139#8302. Incoming AsteroidsDarksideCoderWA 86ms36604kbC++142.0kb2024-10-07 13:15:252024-10-07 13:15:27

Judging History

This is the latest submission verdict.

  • [2024-10-07 13:15:27]
  • Judged
  • Verdict: WA
  • Time: 86ms
  • Memory: 36604kb
  • [2024-10-07 13:15:25]
  • Submitted

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: 100
Accepted
time: 0ms
memory: 16180kb

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: 86ms
memory: 36604kb

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