Submission #572245

# Submission time Handle Problem Language Result Execution time Memory
572245 2022-06-04T05:53:12 Z Pakhridin Radio (COCI22_radio) C++14
10 / 110
1500 ms 748 KB
# include <bits/stdc++.h>
# define flash ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
# define F first
# define S second
# define pb push_back
# define mp make_pair
# define sz(s) s.size()
# define all(x) x.begin(), x.end()
# define allr x.rbegin(), x.rend()
# define in insert
# define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)
# define fore(i, l, r) for(int i = l; i <= r; i++)

typedef long long ll;
typedef double db;
typedef long double ld;
using namespace std;

const int N = 2e5 + 5;
const ll inf = 1e9 + 7;
const ll INF = 1e18;
const db pi = acos(-1.0);

int n, q, cnt[N];

int main (){
	//file(s);
	flash;
	cin >> n >> q;
	while (q--){
		char c;
		cin >> c;
		if (c == 'S'){
			int a;
			cin >> a;
			if (cnt[a] == 0) cnt[a] = 1;
			else cnt[a] = 0;
		}
		else{
			int l, r;
			bool ans = 0;
			cin >> l >> r;
			vector <int> v;
			for (int i = l; i <= r; i++){
				if (cnt[i] == 1){
					v.pb(i);
				}
			}
			for (int i = 0; i < v.size(); i++){
				for (int j = 0; j < v.size(); j++){
					if (__gcd(v[i], v[j]) != 1 && i != j) ans = 1;
				}
			}
			if (ans == 1) cout << "DA\n";
			else cout << "NE\n";
		}
	}
	return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:49:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |    for (int i = 0; i < v.size(); i++){
      |                    ~~^~~~~~~~~~
Main.cpp:50:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |     for (int j = 0; j < v.size(); j++){
      |                     ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 332 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 336 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1591 ms 748 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 332 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 336 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Execution timed out 1591 ms 748 KB Time limit exceeded
9 Halted 0 ms 0 KB -