제출 #555144

#제출 시각아이디문제언어결과실행 시간메모리
555144promaRadio (COCI22_radio)C++17
10 / 110
1588 ms340 KiB
#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;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...