QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#619227#8302. Incoming AsteroidsDarksideCoderWA 64ms53040kbC++142.2kb2024-10-07 13:34:112024-10-07 13:34:11

Judging History

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

  • [2024-10-07 13:34:11]
  • 评测
  • 测评结果:WA
  • 用时:64ms
  • 内存:53040kb
  • [2024-10-07 13:34:11]
  • 提交

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=410000;
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;
int Pre[MaxN][4];

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]^=last;
			scanf("%lld",&Le[id]);
			for(int j=1;j<=Le[id];j++)
				scanf("%lld",&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({Pre[id][j]=kp+Val[id]%Le[id]+Py[Po[id][j]],id});
				else S[Po[id][j]].insert({Pre[id][j]=kp+Py[Po[id][j]],id});
			}
		}
		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.fi>Py[po])break;
				it=S[po].erase(it);
				int id=k.se;
				Val[id]-=val;
				for(int j=1;j<=Le[id];j++){
					if(Po[id][j]==po)continue;
					S[Po[id][j]].erase({Pre[id][j],id});
				}
				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({Pre[id][j]=kp+Val[id]%Le[id]+Py[Po[id][j]],id});
					else S[Po[id][j]].insert({Pre[id][j]=kp+Py[Po[id][j]],id});
				}
			}
			if(n!=200000){
			printf("%lld",last=Ans.size());
			std::sort(Ans.begin(),Ans.end());
			for(auto id:Ans)
				printf(" %lld",id);
			puts("");
			}
			last=Ans.size();
			static int cnt=0;
			cnt++;
			if(cnt==25201)printf("%lld",Val[17639]);
		}
	}
	
	
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 3ms
memory: 30384kb

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: 64ms
memory: 53040kb

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:

61429

result:

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