Universal Cup Judging System

Universal Cup

Time Limit: 1.5 s Memory Limit: 512 MB Total points: 100 Hackable ✓
Statistics

Quad Kingdoms Chess 是一个有趣的棋盘游戏。在这里,我们考虑一个简化版本,涉及两名玩家,玩家 A 和玩家 B,棋子为 $[1, 10^5]$ 之间的整数。游戏过程如下:

  • 最初,玩家 A 有 $n_1$ 枚棋子,形成序列 $A$;玩家 B 有 $n_2$ 枚棋子,形成序列 $B$。序列 $A$ 和 $B$ 均已给出,且玩家 A 和玩家 B 都不能修改它们。
  • 两名玩家分别从各自的序列中派出第一枚棋子,假设分别为 $x, y$,然后进行对战。
    • 如果 $x > y$,意味着玩家 A 的棋子更大,则玩家 B 的棋子进入弃牌堆,不能再使用。随后,玩家 B 从序列中派出下一枚棋子继续对战;
    • 如果 $y > x$,意味着玩家 B 的棋子更大,则玩家 A 的棋子进入弃牌堆,不能再使用。随后,玩家 A 从序列中派出下一枚棋子继续对战;
    • 如果 $x = y$,意味着两枚棋子大小相同,两枚棋子都进入弃牌堆,不能再使用。随后,两名玩家都从各自的序列中派出下一枚棋子继续对战。
  • 在对战过程中,如果一名玩家需要派出棋子但没有剩余棋子,则该玩家输,另一名玩家赢。
    • 特别地,如果两名玩家都需要派出棋子但都没有剩余棋子,则游戏被视为平局。

你可以参考样例说明来理解游戏过程。

玩家 A 和玩家 B 是好朋友,他们不希望游戏中出现赢家;平局会让他们更开心。

给定初始的游戏情况和 $m$ 次修改,在每次修改中,序列中的一枚棋子会被替换为另一枚棋子,且每次修改的效果在后续修改中保留。

在每次修改后,他们希望你帮助分析如果按照该序列进行游戏,游戏结果是否为平局。

输入格式

第一行是一个正整数 $n_1$ ($1 \le n_1 \le 10^5$),表示玩家 A 拥有的棋子数量。 第二行包含 $n_1$ 个正整数 $a_1, a_2, \dots, a_{n_1}$ ($1 \le a_i \le 10^5$),描述序列 $A$。 第三行是一个正整数 $n_2$ ($1 \le n_2 \le 10^5$),表示玩家 B 拥有的棋子数量。 第四行包含 $n_2$ 个正整数 $b_1, b_2, \dots, b_{n_2}$ ($1 \le b_i \le 10^5$),描述序列 $B$。 第五行是一个正整数 $m$ ($1 \le m \le 2 \times 10^5$),描述修改次数。 此后有 $m$ 行,每行包含三个正整数 $o, x, y$ ($1 \le o \le 2, 1 \le x \le n_o, 1 \le y \le 10^5$),含义如下:

  • 如果 $o = 1$,表示将 $a_x$ 修改为 $y$;
  • 如果 $o = 2$,表示将 $b_x$ 修改为 $y$。

输出格式

对于每次修改,输出一行。如果游戏结果为平局,输出 YES;否则,输出 NO。

样例

输入 1

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

输出 1

NO
NO
NO
YES
NO
NO
NO
YES

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.