답안 #555109

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
555109 2022-04-30T07:31:36 Z snasibov05 Radio (COCI22_radio) C++14
10 / 110
1500 ms 252 KB
#include <bits/stdc++.h>

using namespace std;

int gcd(int a, int b){
    while (b){
        a %= b;
        swap(a, b);
    }
    return a;
}

int main() {
    int n, q; cin >> n >> q;

    vector<bool> v(n+1);
    for (int i = 0; i < q; ++i){
        char t; cin >> t;
        if (t == 'S') {
            int x; cin >> x;
            v[x] = !v[x];
        } else{
            int l, r; cin >> l >> r;
            bool flag = true;
            for (int j = l; j <= r; ++j){
                if (!v[j]) continue;
                for (int f = j + 1; f <= r; ++f){
                    if (!v[f]) continue;
                    if (gcd(j, f) > 1) flag = false;
                }
            }

            if (flag) cout << "NE\n";
            else cout << "DA\n";
        }
    }

    return 0;
}
# 결과 실행 시간 메모리 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 252 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 1590 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 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 252 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 1590 ms 212 KB Time limit exceeded
9 Halted 0 ms 0 KB -