답안 #555115

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
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;
}
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1585 ms 212 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 -