#P8327. [COCI 2021/2022 #5] Radio
[COCI 2021/2022 #5] Radio
Problem Description
There are radio stations in Croatia, all initially turned off. If two stations are turned on at the same time and are not coprime, then they will interfere with each other.
You need to write a program that supports the following operations:
S x: Toggle the status of station , i.e., turn it off if it is on, and turn it on if it is off.C l r: Check whether there exists interference within . If it exists, outputDA; otherwise outputNE.
Input Format
The first line contains two positive integers , representing the number of radio stations and the number of operations.
The next lines describe the operations. The exact input format is given in the statement description.
Output Format
For each C operation, output DA or NE.
6 8
S 1
S 2
S 3
C 1 6
S 6
C 1 6
S 2
C 1 6
NE
DA
DA
11 6
S 4
S 10
C 3 11
C 2 7
S 6
C 2 7
DA
NE
DA
20 7
S 10
S 15
S 3
C 10 15
S 10
C 3 15
C 3 10
DA
DA
NE
Hint
[Sample 1 Explanation]
Index of C Operation |
Turned-on Stations | Interference? |
|---|---|---|
| No | ||
| Yes | ||
[Constraints and Notes]
This problem uses bundled testdata.
- Subtask 1 (10 pts): , .
- Subtask 2 (30 pts): For all
Coperations, . - Subtask 3 (70 pts): No additional constraints.
For of the testdata, , , , .
[Source] COCI 2021-2022#5 Task 4 Radio.
Translated by ChatGPT 5