QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#287327#7517. Flying Ship Storyship2077WA 91ms3824kbC++14944b2023-12-20 11:38:342023-12-20 11:38:36

Judging History

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

  • [2023-12-20 11:38:36]
  • 评测
  • 测评结果:WA
  • 用时:91ms
  • 内存:3824kb
  • [2023-12-20 11:38:34]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int T,x,y,op,lastans,buc[4];
vector<array<int,3>>vec;
int read(){
	int x=0,f=1;char ch=getchar();
	while (!isdigit(ch)) {if (ch=='-') f=-1;ch=getchar();}
	while (isdigit(ch)) x=x*10+ch-48,ch=getchar();
	return x*f;
}
void insert(int x,int y,int c){
	int pos=0;
	for (int i=0;i<vec.size();i++)
		if (vec[i][2]<c) pos=i;
	vec.insert(vec.begin()+pos,{x,y,c});
	buc[0]=buc[1]=buc[2]=buc[3]=0;
	for (int i=0;i<vec.size();i++){
		int sta=(vec[0][0]==vec[i][0])|(vec[0][1]==vec[i][1])<<1;
		if (buc[sta]) return vec.erase(vec.begin()+i),void(); buc[sta]=1;
	}
}
int query(int x,int y){
	for (int i=0;i<vec.size();i++)
		if (vec[i][0]!=x&&vec[i][1]!=y)
			return vec[i][2];
	return 0;
}
int main(){
	T=read();while (T--){
		op=read();x=read()^lastans;y=read()^lastans;
		if (op==1) insert(x,y,read()^lastans);
		if (op==2) printf("%d\n",lastans=query(x,y));
	}
	return 0;
}

詳細信息

Test #1:

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

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: 91ms
memory: 3824kb

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
502113644
502113644
502113644
908314375
480670688
480670688
244508051
475386902
475386902
214540979
214540979
350053255
350053255
350053255
350053255
350053255
350053255
191037779
191037779
93068688
93068688
93068688
93068688
93068688
93068688
93068688
649960807
64996...

result:

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