#include<bits/stdc++.h>
using namespace std;
long long n, m, x, y;
char c;
bool check[201];
int main()
{
cin >> n >> m;
while(m--)
{
cin >> c;
if(c == 'S')
{
cin >> x;
check[x] = 1 - check[x];
}
else
{
cin >> x >> y;
bool chk = 0;
for(int i = x; i <= y; ++i)
{
for(int j = i + 1; j <= y; ++j)
{
if(check[i] && check[j] && __gcd(i, j) > 1)
{
chk = 1;
break;
}
}
if(chk) break;
}
if(!chk) cout << "NE\n";
else cout << "DA\n";
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
436 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
436 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
9 |
Halted |
0 ms |
0 KB |
- |