Submission #644947

# Submission time Handle Problem Language Result Execution time Memory
644947 2022-09-25T16:21:54 Z Iwanttobreakfree Radio (COCI22_radio) C++17
10 / 110
1500 ms 724 KB
#include <iostream>
#include <vector>

using namespace std;

int gcd (int a,int b) {
    if (!b) return a;
    return gcd (b, a%b);
}

int main() {
    int n, q;
    cin >> n >> q;
    vector<int> v (n+1);
    while (q--) {
        char t;
        cin >> t;
        if (t == 'C') {
            int x, y;
            cin >> x >> y;
            bool ok = false;
            for (int i = x;i <= y; ++i) {
                for (int j = i+1; j<=y;++j){
                    if (v[i]&&v[j]&&gcd (i, j) > 1) ok = true;
                }
            }
            if (ok) cout << "DA\n";
            else cout << "NE\n";

        } else {
            int x;
            cin >> x;
            v[x] = 1-v[x];

        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 300 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 300 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1577 ms 724 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 300 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 300 KB Output is correct
8 Execution timed out 1577 ms 724 KB Time limit exceeded
9 Halted 0 ms 0 KB -