QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#354374#8338. Quad Kingdoms Chessship2077WA 20ms3776kbC++14607b2024-03-15 11:06:152024-03-15 11:06:15

Judging History

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

  • [2024-03-15 11:06:15]
  • 评测
  • 测评结果:WA
  • 用时:20ms
  • 内存:3776kb
  • [2024-03-15 11:06:15]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
constexpr int M=1e5+5;
int m,op,x,y,n[3],a[3][M];
int main(){
	scanf("%d",&n[1]);
	for (int i=1;i<=n[1];i++) scanf("%d",&a[1][i]);
	scanf("%d",&n[2]);
	for (int i=1;i<=n[2];i++) scanf("%d",&a[2][i]);
	scanf("%d",&m);
	for (int i=1;i<=m;i++){
		scanf("%d%d%d",&op,&x,&y);a[op][x]=y;
		unsigned long long hash1=0,hash2=0;int mx1=0,mx2=0;
		for (int i=n[1];i;i--) if (a[1][i]>mx1) hash1=hash1*233+a[1][i],mx1=a[1][i];
		for (int i=n[2];i;i--) if (a[2][i]>mx2) hash2=hash2*233+a[2][i],mx2=a[2][i];
		puts(hash1==hash2?"YES":"NO");
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3776kb

input:

5
1 2 3 4 5
5
5 4 3 2 1
8
1 1 5
1 4 2
1 2 4
1 5 1
1 5 5
2 1 4
2 3 5
2 5 5

output:

NO
NO
NO
YES
NO
NO
NO
YES

result:

ok 8 tokens

Test #2:

score: -100
Wrong Answer
time: 20ms
memory: 3776kb

input:

1
2
6
2 1 1 1 1 1
200000
2 6 2
1 1 1
1 1 1
1 1 2
2 1 1
1 1 2
1 1 1
2 4 1
2 1 2
1 1 1
1 1 2
2 5 1
1 1 1
1 1 2
1 1 1
2 6 1
1 1 2
1 1 2
1 1 2
2 3 1
1 1 1
2 1 1
2 6 2
1 1 2
2 4 1
1 1 2
2 6 1
1 1 2
1 1 1
2 5 2
2 6 2
1 1 1
2 4 2
2 5 2
2 6 2
1 1 1
2 5 1
2 6 2
1 1 2
1 1 1
1 1 1
2 4 1
1 1 2
1 1 2
1 1 2
2 3 2...

output:

YES
NO
NO
YES
YES
YES
NO
NO
NO
NO
YES
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
YES
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO...

result:

wrong answer 1st words differ - expected: 'NO', found: 'YES'