Submission #572285

# Submission time Handle Problem Language Result Execution time Memory
572285 2022-06-04T07:55:01 Z Chal1shkan Radio (COCI22_radio) C++14
10 / 110
1500 ms 968 KB
# include <bits/stdc++.h>
# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>

# define mkp make_pair
# define ff first
# define ss second
 
# define vec vector
# define pb push_back
# define pf push_front
# define ppb pop_back
# define ppf pop_front

# define all(x) (x).begin(), (x).end()
# define rall(x) (x).rbegin(), (x).rend()
# define sz(x) ((ll)(x).size())
# define lb lower_bound
# define ub upper_bound
# define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 

# define br break
# define rt return 
# define cn continue
# define nl "\n"
# define off exit(0)
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const ll N = 2e5 + 25;
const ll NN = 1e4 + 25;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const ll M0D = 998244353;
const ld PI = acos((ld) -1);
const ll P = 53;

using namespace __gnu_pbds;
using namespace std;

bool used[N];

void ma1n ()
{
	ll n, m;
	cin >> n >> m;
	while (m--)
	{
		char type;
		cin >> type;
		if (type == 'S')
		{
			ll x;
			cin >> x;
			used[x] = !used[x];
		}
		if (type == 'C')
		{
			ll l, r;
			cin >> l >> r;
			vec <ll> x;
			for (ll i = l; i <= r; ++i)
			{
				if (used[i]) x.pb(i);
			}
			sort(rall(x));
			bool ok = 0;
			for (ll i = 0; i < sz(x) && !ok; ++i)
			{
				for (ll j = i + 1; j < sz(x) && !ok; ++j)
				{
					if (__gcd(x[i], x[j]) > 1)
					{
						ok = 1;
					}
				}
			}
			cout << (ok ? "DA" : "NE") << nl;
		}
	}
}

int main (/*?*/)
{	
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
//	freopen ("file.in", "r", stdin);
//  freopen ("file.out", "w", stdout);
	ll zxc = 1;
//	cin >> zxc;
	while (zxc--)
	{
		ma1n();
	}
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 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 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 1551 ms 968 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 1 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 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Execution timed out 1551 ms 968 KB Time limit exceeded
9 Halted 0 ms 0 KB -