QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#252793 | #7517. Flying Ship Story | zhuibao | WA | 236ms | 3776kb | C++20 | 4.1kb | 2023-11-16 11:05:01 | 2023-11-16 11:05:01 |
Judging History
answer
#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll; typedef unsigned long long ull; typedef pair<ll, ll>pi; typedef complex<double>cx;
#define int ll
#define X first
#define Y second
#define fer(i,a,n) for(int i=a;i<=n;i++)
#define ref(i,n,a) for(int i=n;i>=a;i--)
#define endl '\n'
#define mem(a,x) memset(a,x,sizeof a)
#define ac IO;int t;cin>>t;while(t--)solve()
#define AC signed main(){IO;solve();}
#define NO {cout<<"No"<<endl;return;}
#define YES {cout<<"Yes"<<endl;return;}
#define re(a) {cout<<a<<endl;return;}
#define all(v) v.begin(),v.end()
//ofstream fout("1.out", ios::out);
//ifstream fin("1.in", ios::in);
//#define cout fout
//#define cin fin
//--------------------瑞神神中神--------------------
const int N=1e6+10;
int n;
struct node
{
int x,y,w;
bool operator<(const node&t)const
{
return w>t.w;
}
};
set<node>se;
void solve()
{
cin>>n;
int ans=0;
while(n--)
{
int op,x,y;
cin>>op>>x>>y;
x^=ans;y^=ans;
if(op==1)
{
int w;cin>>w;
w^=ans;
int tw=0;
for(auto[nx,ny,nw]:se)
{
if(x==nx&&y==ny)
{
tw=nw;
}
}
if(tw)
{
if(w>tw)
{
se.erase({x,y,tw});
se.insert({x,y,w});
}
}
else
{
se.insert({x,y,w});
}
vector<node>del;
int sta=0,nx=0,ny=0,tx=0,ty=0,cnt=0;
for(auto[x,y,w]:se)
{
cnt++;
if(sta==0)
{
sta=1;
nx=x;ny=y;
}
else if(sta==1)
{
if(x!=nx&&y!=ny)
{
sta=4;
tx=x;ty=ny;
ny=y;
}
else if(x==nx)
{
sta=2;
}
else
{
sta=3;
}
}
else if(sta==2)
{
if(x==nx)
{
del.push_back({x,y,w});
}
else
{
sta=5;ny=y;
}
}
else if(sta==3)
{
if(y==ny)
{
del.push_back({x,y,w});
}
else
{
sta=5;
nx=x;
}
}
else if(sta==4)
{
if(x==nx||y==ny)
{
sta=5;
}
else if(x==tx||y==ty)
{
sta=5;
swap(tx,nx);swap(ty,ny);
}
else
{
sta=6;
}
}
else if(sta==5)
{
if(x==nx||y==ny)
{
sta=5;
}
else
{
sta=6;
}
}
if(sta==6)
{
del.push_back({x,y,w});
}
}
for(auto[x,y,w]:del)
{
se.erase({x,y,w});
}
}
else
{
ans=0;
for(auto[nx,ny,w]:se)
{
if(nx==x||ny==y)continue;
ans=w;break;
}
cout<<ans<<'\n';
}
}
}
AC
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3776kb
input:
5 1 2 3 1 1 4 5 2 2 2 2 2 3 7 2 3 4
output:
2 1 0
result:
ok 3 lines
Test #2:
score: 0
Accepted
time: 211ms
memory: 3604kb
input:
1000000 2 370943499 431961772 1 1 1 11995570 2 37566858 838793045 1 11995571 11995569 908148975 2 11995571 11995571 1 1 3 716821068 2 67877937 3 1 11995571 11995571 771898489 2 38381714 99749723 1 915818844 915818847 729541681 2 592361351 915818846 1 783627722 783627722 639375021 2 102203700 8636489...
output:
0 11995570 0 11995570 915818845 783627723 915818845 0 0 915818845 0 783627723 0 904468304 904468304 904468304 915818845 904468304 915818845 904468304 915818845 0 904468304 0 915818845 915818845 0 0 915818845 915818845 0 921710773 0 921710773 998138906 921710773 0 921710773 998138906 0 998138906 0 99...
result:
ok 500000 lines
Test #3:
score: -100
Wrong Answer
time: 236ms
memory: 3612kb
input:
1000000 2 648544745 437316088 1 1 1 221075686 2 802693951 691188141 1 221075687 221075684 1036811136 2 771835961 178451319 1 820061031 820061031 560017372 2 829408420 820061028 1 293604539 293604539 699366423 2 293604539 293604539 1 1 2 610044241 2 50747012 885321059 1 942633132 942633132 603537610 ...
output:
0 221075686 820061030 293604538 0 942633133 942633133 27478144 820061030 820061030 900696946 27478144 942633133 942633133 0 772167494 0 942633133 942633133 942633133 993732581 993732581 942633133 993732581 993732581 993732581 993732581 993732581 993732581 963734369 993732581 963734369 993732581 9937...
result:
wrong answer 17th lines differ - expected: '27478144', found: '0'