Submission #704259

# Submission time Handle Problem Language Result Execution time Memory
704259 2023-03-02T02:07:42 Z ancuber1031 Radio (COCI22_radio) C++14
10 / 110
1500 ms 1108 KB
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define pii pair<int,int>
#define p_q priority_queue
#define endl '\n'
#define pb push_back

signed main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n, q; cin>>n>>q;
    vector<int> bl(n+1,0);
    while(q--) {
        char c; cin>>c;
        if (c == 'S') {
            int k; cin>>k;
            bl[k] = !bl[k];
        } else {
            int cnt = 0;
            int l, r; cin>>l>>r;
            for (int i = l; i <= r; ++i) {
                for (int j = i+1; j <= r; ++j) {
                    if (!bl[i] || !bl[j]) continue;
                    cnt += (__gcd(i,j) != 1);
                }
            }
            if (cnt) cout<<"DA"<<endl;
            else cout<<"NE"<<endl;
        }
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 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 316 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 1568 ms 1108 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 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 316 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 1568 ms 1108 KB Time limit exceeded
9 Halted 0 ms 0 KB -