QOJ.ac

QOJ

実行時間制限: 2 s メモリ制限: 256 MB 満点: 100

#18796. 수열과 쿼리 38

統計

Początkowo istnieje tablica $A$ zawierająca pojedyncze 0. Następnie należy wykonać następujące zapytania:

  • 1 x: Dołącz x na koniec $A$.
  • 2 x: Usuń x z $A$. Jeśli $A$ zawiera dwa lub więcej x, usuń tylko pierwsze wystąpienie. Gwarantowane jest, że $x$ znajduje się w $A$ w momencie zapytania.
  • 3: Wypisz sumę wszystkich elementów w $A$.
  • 4: Wypisz XOR wszystkich elementów w $A$.

Wejście

Pierwszy wiersz zawiera liczbę całkowitą $M$, liczbę zapytań. Kolejne $M$ wierszy zawiera po jednym zapytaniu.

Wyjście

Za każdym razem, gdy pojawi się zapytanie typu 3 lub 4, wypisz odpowiedź, każdą w osobnym wierszu.

Przykład

Wejście 1

12
1 3
1 1
1 4
3
4
1 1
3
4
2 1
2 4
3
4

Wyjście 1

8
6
9
7
4
2

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.