結果

問題 No.2080 Simple Nim Query
ユーザー みここ
提出日時 2022-12-12 21:54:27
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 670 ms / 3,000 ms
コード長 659 bytes
コンパイル時間 886 ms
コンパイル使用メモリ 77,040 KB
最終ジャッジ日時 2025-02-09 10:36:14
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8
権限があれば一括ダウンロードができます

ソースコード

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