#include<bits/stdc++.h>
using namespace std;
int main () {
int n, q;
cin >> n >> q;
if(n <= 100 and q <= 200) {
vector<int> v(n+1);
while(q--) {
char c;
cin >> c;
if(c == 'S') {
long long in;
cin >> in;
v[in] ^= 1;
}
else if(c == 'C') {
long long l, r;
cin >> l >> r;
bool check = false;
for(int i =l;i<=r;i++) {
for(int j = l;j<=r;j++) {
if(j == i)continue;
if(!v[j] or !v[i])continue;
if(__gcd(i, j)!=1) {
check = true;
}
}
}
cout << (check?"DA":"NE") << "\n";
}
}
}
else {
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
2 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
2 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |