답안 #644947

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
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];

        }
    }
}
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1577 ms 724 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 -