Submission #879962

#TimeUsernameProblemLanguageResultExecution timeMemory
879962HossamHero7Radio (COCI22_radio)C++14
10 / 110
1566 ms552 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...