QOJ.ac

QOJ

Süre Sınırı: 2 s Bellek Sınırı: 256 MB Toplam puan: 100

#18796. 수열과 쿼리 38

İstatistikler

Изначально есть массив $A$, содержащий один 0. Затем необходимо выполнить следующие запросы:

  • 1 x: Добавить x в конец $A$.
  • 2 x: Удалить x из $A$. Если $A$ содержит два или более x, удалить только первое вхождение. Гарантируется, что $x$ присутствует в $A$ на момент выполнения запроса.
  • 3: Вывести сумму всех элементов $A$.
  • 4: Вывести XOR всех элементов $A$.

Входные данные

Первая строка содержит целое число $M$ — количество запросов. Следующие $M$ строк содержат по одному запросу.

Выходные данные

Каждый раз, когда встречается запрос типа 3 или типа 4, выводите ответ, каждый на отдельной строке.

Примеры

Входные данные 1

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

Выходные данные 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.