結果

問題 No.2080 Simple Nim Query
ユーザー みここみここ
提出日時 2022-12-12 21:54:27
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 545 ms / 3,000 ms
コード長 659 bytes
コンパイル時間 621 ms
コンパイル使用メモリ 78,272 KB
実行使用メモリ 12,760 KB
最終ジャッジ日時 2023-09-03 02:51:25
合計ジャッジ時間 4,819 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 270 ms
4,380 KB
testcase_04 AC 280 ms
4,380 KB
testcase_05 AC 545 ms
12,760 KB
testcase_06 AC 375 ms
5,520 KB
testcase_07 AC 371 ms
5,568 KB
testcase_08 AC 495 ms
10,992 KB
testcase_09 AC 462 ms
10,900 KB
testcase_10 AC 356 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <set>
using namespace std;

int main()
{
    int n, q;
    cin >> n >> q;
    set<int> st;
    st.insert(-1);
    for (int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        if (a >= 2)
        {
            st.insert(i);
        }
    }
    while (q--)
    {
        int t, x, y;
        cin >> t >> x >> y;
        x--;
        if (t == 1)
        {
            st.erase(x);
            if (y >= 2)
            {
                st.insert(x);
            }
        }
        else
        {
            int i = max(x, *--st.lower_bound(y));
            cout << ((y - i) % 2 ? "F" : "S") << endl;
        }
    }
}
0