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;
int main(){
ll n, q;
cin>>n>>q;
vector<bool> v(n+1, false);
while(q--){
char c;
cin>>c;
if(c=='S'){
ll k;
cin>>k;
v[k]=(!v[k]);
}
else {
ll l, r;
cin>>l>>r;
bool f=false;
for(ll i=l; i<r; i++){
if(v[i]){
for(ll j=i+1; j<=r; j++){
if(v[j]){
if(__gcd(i, j)>1){
f=true;
break;
}
}
}
}
}
if(f)cout<<"DA"<<endl;
else cout<<"NE"<<endl;
}
}
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... |