QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#276067#7517. Flying Ship StorywangqingxianWA 327ms3712kbC++141.8kb2023-12-05 15:50:532023-12-05 15:50:55

Judging History

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

  • [2023-12-05 15:50:55]
  • 评测
  • 测评结果:WA
  • 用时:327ms
  • 内存:3712kb
  • [2023-12-05 15:50:53]
  • 提交

answer

#include<algorithm>
#include<vector>
#include<cstdio>
#include<map>
#include<cstring>
#include<iostream>
#include<cstdlib>
#include<iomanip>
#include<bitset>
#include<queue>
#include<cassert>
#include<stdlib.h>
#include<cmath>
#include<set>
#define TIME (double)clock()/(double)CLOCKS_PER_SEC
//#define ll long long
#define ld long double
#define For(i,l,r) for(int i=(l);i<=(r);++i)
#define rof(i,r,l) for(int i=(r);i>=(l);--i)
#define db double
#define mem0(a) memset(a,0,sizeof(a))
#define ull unsigned long long
#define lowbit(t) (t&-t)
#define uint unsigned int
//#define int long long
#define x1 dlskjfakljflkasd
#define y1 sldkfjalfjkalskl
#define x2 sdalkfjaklfjsdlk
#define y2 sfjaofoiwjfwfwof
using namespace std;
//const int N=5e3+1,inf=1e18,mod=998244353;
int q;
struct giao{int x,y,w;};
bool cmp(giao g1,giao g2){return g1.w>g2.w;}
giao p[6];
int m=-1;
int ans=0;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cin>>q;
    while(q--){
        int op,x,y,w;
        cin>>op>>x>>y;
        x^=ans;y^=ans;
        if(op==1){
            cin>>w;
            w^=ans;
            p[++m]={x,y,w};
            sort(p+1,p+1+m,cmp);
            For(i,1,m){
                int c1=0,c2=0;
                For(j,0,i-1){
                    c1+=(p[j].x==p[i].x);
                    c2+=(p[j].y==p[i].y);
                }
                if(c1>1||c2>1)p[i]={0,0,0};
            }
            sort(p+1,p+1+m,cmp);
            m=min(m,4);
        }
        else{
            ans=0;
            For(i,0,m){
                if(p[i].x!=x&&p[i].y!=y){
                    ans=max(p[i].w,ans);
                }
            }
            cout<<ans<<endl;
        }
    }
    return 0;
}
/*
5
 1 2 3 1
 1 4 5 2
 2 2 2
 2 3 7
 2 3 4
 */

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3704kb

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: -100
Wrong Answer
time: 327ms
memory: 3712kb

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
11995570
915818845
648748831
915818845
915818845
648748831
915818845
915818845
928786788
928786788
928786788
928786788
928786788
928786788
928786788
928786788
928786788
928786788
928786788
968045991
968045991
968045991
968045991
968045991
968045991
968045991
968045991...

result:

wrong answer 6th lines differ - expected: '783627723', found: '11995570'