Logo
(追記) (追記ここまで)

24721번 - Radio 서브태스크다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1.5 초 512 MB222100.000%

문제

In Croatia there are $n$ radio stations. Each station has a concession on one of $n$ frequencies denoted by positive integers from 1ドル$ to $n$. The frequencies were not chosen ideally so sometimes noise appears when multiple stations are broadcasting at the same time. To be more precise, if two radio stations, with frequencies $a$ and $b$ respectively, are broadcasting at the same time, noise will appear if $a$ and $b$ are not relatively prime. The listeners, of course, do not like the noise, so when they hear it they switch to another station.

To solve this noise problem, the radio station owners are asking you to write a program which simulates the actions of the radio stations. Your program needs to support two types of queries:

  1. $S$ $x$: If not currently broadcasting, the station with frequency $x$ starts broadcasting, and if it is already broadcasting, it stops.
  2. $C$ $l$ $r$: Check if there exists a pair of broadcasting stations whose frequencies $a$ and $b$ are from the interval $[l, r]$ and such that $\gcd{(a, b)} \ne 1$. If such a pair exists, print DA, otherwise print NE.

Initially, no station is broadcasting.

입력

The first line contains positive integers $n$ and $q$ (1ドル ≤ n ≤ 1,000円,000円,ドル 1ドル ≤ q ≤ 200,000円$), the number of radio stations (and frequencies), and the number of queries, respectively.

The $i$-th of the next $q$ lines contains a description of the $i$-th query. For queries of the first type it will hold that 1ドル ≤ x ≤ n,ドル and for queries of the second type it will hold that 1ドル ≤ l ≤ r ≤ n$.

출력

Print the answers to the queries of the second type in order, in separate lines.

제한

서브태스크

번호배점제한
110

1ドル ≤ n ≤ 100,ドル 1ドル ≤ q ≤ 200$

230

For all queries of the second type it holds that $l = 1$ and $r = n$.

370

No additional constraints.

예제 입력 1

6 8
S 1
S 2
S 3
C 1 6
S 6
C 1 6
S 2
C 1 6

예제 출력 1

NE
DA
DA

예제 입력 2

11 6
S 4
S 10
C 3 11
C 2 7
S 6
C 2 7

예제 출력 2

DA
NE
DA

예제 입력 3

20 7
S 10
S 15
S 3
C 10 15
S 10
C 3 15
C 3 10

예제 출력 3

DA
DA
NE

힌트

Clarification of the first example:

The stations broadcasting during the first C type query are 1, 2 and 3. These numbers are all relatively prime to each other so they create no noise. Once station 6 begins to broadcast, it creates noise with stations 2 and 3. After station 2 stops broadcasting the noise with station 3 persists.

출처

Contest > Croatian Open Competition in Informatics > COCI 2021/2022 > Contest #5 4번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /