This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
long long n, q;
bool a[201];
int main() {
cin >> n >> q;
while(q--) {
char op; cin >> op;
if(op == 'S') {
int x; cin >> x;
a[x] = 1 - a[x];
}
else {
int x, y; cin >> x >> y;
bool ans = 0;
for(int i = x; i <= y; i++) {
for(int j = i++; j <= y; j++) {
if(a[i] && a[j] && __gcd(i, j) > 1) {
ans = 1; break;
}
}
if(ans) break;
}
if(ans) cout << "DA\n"; else cout << "NE\n";
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |