RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00618

Radio

Unrated 레이팅 미적용
난이도
1s
시간 제한
256MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

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)̸ = 1. If such a pair exists, print DA, otherwise print NE.
Initially, no station is broadcasting.

제약

Subtask 1 (10 points): \(1 \le n \le 100\), \(1 \le q \le 200\)

Subtask 2 (30 points): For all queries of the second type it holds that \(l = 1\) i \(r = n\).

Subtask 3 (70 points): No additional constraints.

입력 형식

The first line contains positive integers \(n\) and \(q\) (\(1 \le n \le 1\,000\,000\), \(1 \le q \le 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 \le x \le n\), and for queries of the second type it will hold that \(1 \le l \le r \le n\).

출력 형식

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

서브태스크
서브태스크점수설명

1

10점

\(1 \le n \le 100\), \(1 \le q \le 200\)

2

30점

For all queries of the second type it holds that \(l = 1\) i \(r = n\).

3

70점

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
출력
NE
DA
DA
예제 2
입력
11 6
S 4
S 10
C 3 11
C 2 7
S 6
C 2 7
출력
DA
NE
DA
예제 3
입력
20 7
S 10
S 15
S 3
C 10 15
S 10
C 3 15
C 3 10
출력
DA
DA
NE
문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2021/2022 Contest 5

평가 및 의견

Radio

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Radio

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8