QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#18796. Dãy số và Truy vấn 38

Statistics

Ban đầu, có một mảng $A$ chứa duy nhất một phần tử 0. Sau đó, cần thực hiện các truy vấn sau:

  • 1 x: Thêm x vào cuối $A$.
  • 2 x: Xóa x khỏi $A$. Nếu $A$ có hai hoặc nhiều phần tử x, chỉ xóa phần tử xuất hiện đầu tiên. Dữ liệu đảm bảo rằng x có mặt trong $A$ tại thời điểm truy vấn.
  • 3: In ra tổng tất cả các phần tử trong $A$.
  • 4: In ra XOR của tất cả các phần tử trong $A$.

Dữ liệu vào

Dòng đầu tiên chứa một số nguyên $M$, số lượng truy vấn. $M$ dòng tiếp theo mỗi dòng chứa một truy vấn.

Dữ liệu ra

Mỗi khi có truy vấn loại 3 hoặc loại 4, hãy in ra kết quả, mỗi kết quả trên một dòng riêng.

Ví dụ

Dữ liệu vào 1

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

Dữ liệu ra 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.