QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#619143 | #8302. Incoming Asteroids | DarksideCoder | WA | 2ms | 18416kb | C++14 | 2.0kb | 2024-10-07 13:16:14 | 2024-10-07 13:16:17 |
Judging History
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'