結果

問題 No.2080 Simple Nim Query
ユーザー Carpenters-CatCarpenters-Cat
提出日時 2022-09-27 02:55:57
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 633 ms / 3,000 ms
コード長 687 bytes
コンパイル時間 2,108 ms
コンパイル使用メモリ 206,508 KB
実行使用メモリ 12,716 KB
最終ジャッジ日時 2023-09-03 02:50:39
合計ジャッジ時間 6,995 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 307 ms
4,384 KB
testcase_04 AC 315 ms
4,376 KB
testcase_05 AC 633 ms
12,716 KB
testcase_06 AC 433 ms
5,392 KB
testcase_07 AC 438 ms
5,476 KB
testcase_08 AC 556 ms
10,932 KB
testcase_09 AC 554 ms
10,848 KB
testcase_10 AC 410 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main () {
    int N, Q;
    cin >> N >> Q;
    set<int> st;
    st.insert(1000);
    for (int i = 1; i <= N; i ++) {
        int a;
        cin >> a;
        if (a > 1) {
            st.insert(-i);
        }
    }
    for (int q = 0;q < Q; q ++) {
        int t, x, y;
        cin >> t >> x >> y;
        if (t == 1) {
            if (y > 1) {
                st.insert(-x);
            } else if (st.find(-x) != st.end()) {
                st.erase(-x);
            }
        } else {
            int pk = -(*st.lower_bound(-y));
            int d = min(y - x, y - pk);
            cout << (d % 2 ? "S" : "F") << endl;
        }
    }
}
0