QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#354372#8338. Quad Kingdoms Chessship2077RE 0ms0kbC++14607b2024-03-15 11:05:112024-03-15 11:05:13

Judging History

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

  • [2024-03-15 11:05:13]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-03-15 11:05:11]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
constexpr int M=1e5+5;
int m,op,x,y,n[2],a[2][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;
}

詳細信息

Test #1:

score: 0
Runtime Error

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:


result: