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>
#define int long long
#define endl "\n"
#define see(x) cout<<#x<<"="<<x<<"\n";
using namespace std;
const int N = 1e6+5;
int n, q, a[N];
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n >> q;
while (q --) {
char c;
cin >> c;
if (c == 'S') {
int x;
cin >> x;
a[x] = 1 - a[x];
}
else {
int l, r, flag = 0;
cin >> l >> r;
for (int i = l; i < r; i ++) {
for (int j = i + 1; j <= r; j ++) {
if (a[i] and a[j] and __gcd(i, j) != 1) {
flag = 1;
}
}
}
if (flag) cout << "DA\n";
else cout << "NE\n";
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |