結果

問題 No.2080 Simple Nim Query
ユーザー Carpenters-CatCarpenters-Cat
提出日時 2022-09-27 02:53:30
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 686 bytes
コンパイル時間 2,023 ms
コンパイル使用メモリ 206,404 KB
実行使用メモリ 12,752 KB
最終ジャッジ日時 2023-08-24 03:27:41
合計ジャッジ時間 5,846 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 WA -
testcase_02 AC 2 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

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