답안 #555144

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
555144 2022-04-30T08:33:32 Z proma Radio (COCI22_radio) C++17
10 / 110
1500 ms 340 KB
#include <bits/stdc++.h>

#define int long long
#define endl "\n"
#define see(x) cout<<#x<<"="<<x<<"\n";

using namespace std;

const int N = 1e6+5;

int n, q, a[N];

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin >> n >> q;

    while (q --) {
        char c;
        cin >> c;
        if (c == 'S') {
            int x;
            cin >> x;
            a[x] = 1 - a[x];
        }
        else {
            int l, r, flag = 0;
            cin >> l >> r;
            for (int i = l; i < r; i ++) {
                for (int j = i + 1; j <= r; j ++) {
                    if (a[i] and a[j] and __gcd(i, j) != 1) {
                        flag = 1;
                    }
                }
            }
            if (flag) cout << "DA\n";
            else cout << "NE\n";
        }
    }

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 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 1588 ms 340 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 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 1588 ms 340 KB Time limit exceeded
9 Halted 0 ms 0 KB -