Submission #555115

# Submission time Handle Problem Language Result Execution time Memory
555115 2022-04-30T07:43:47 Z Fidan Radio (COCI22_radio) C++17
10 / 110
1500 ms 212 KB
#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
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1585 ms 212 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Execution timed out 1585 ms 212 KB Time limit exceeded
9 Halted 0 ms 0 KB -