QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#354373#8338. Quad Kingdoms Chessship2077WA 1ms3676kbC++14607b2024-03-15 11:05:402024-03-15 11:05:41

Judging History

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

  • [2024-03-15 11:05:41]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3676kb
  • [2024-03-15 11:05:40]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
constexpr int M=1e5+5;
int m,op,x,y,n[2],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: 0
Wrong Answer
time: 1ms
memory: 3676kb

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
NO
NO
NO
NO
YES

result:

wrong answer 4th words differ - expected: 'YES', found: 'NO'