Submission #555158

# Submission time Handle Problem Language Result Execution time Memory
555158 2022-04-30T08:45:35 Z Fidan Radio (COCI22_radio) C++17
0 / 110
1500 ms 212 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll n, q, s=0, i;
	cin>>n>>q;
	vector<bool> v(n+1, false);
	while(q--){
		char c;
		cin>>c;
		if(c=='S'){
			ll k;
			cin>>k;
			if(v[k]){
				v[k]=false;
				for(i=1; i<=n; i++){
					if(v[i] && __gcd(i, k)>1) {
						s--;
					}
				}
			}
			else {
				for(i=1; i<=n; i++){
					if(v[i] && __gcd(i, k)>1){
						s++;
					}
				}
				v[k]=true;
			}
		}
		else {
			ll l, r;
			cin>>l>>r;
			if(s==0) cout<<"NE"<<endl;
			else cout<<"DA"<<endl;
		}
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1594 ms 212 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -