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;
typedef long long ll;
#define endl '\n'
const int N = 1e6+5;
bool on[N];
void solve(){
int n,q;
cin>>n>>q;
while(q--){
char c;
cin>>c;
if(c == 'S'){
int x;cin>>x;
on[x] = !on[x];
}
else {
int l,r;
cin>>l>>r;
bool b = 0;
for(int i=l;i<=r;i++){
if(!on[i]) continue;
for(int j=i+1;j<=r;j++){
if(!on[j]) continue;
b |= __gcd(i,j) > 1;
}
}
cout<<(b ? "DA" : "NE")<<endl;
}
}
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int t=1;
//cin>>t;
while(t--){
solve();
}
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... |