結果

問題 No.2080 Simple Nim Query
ユーザー t98slidert98slider
提出日時 2022-09-25 21:49:35
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 255 ms / 3,000 ms
コード長 674 bytes
コンパイル時間 6,889 ms
コンパイル使用メモリ 171,804 KB
実行使用メモリ 13,356 KB
最終ジャッジ日時 2023-09-03 02:49:07
合計ジャッジ時間 3,791 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 48 ms
4,380 KB
testcase_04 AC 48 ms
4,380 KB
testcase_05 AC 255 ms
13,356 KB
testcase_06 AC 106 ms
6,216 KB
testcase_07 AC 107 ms
5,856 KB
testcase_08 AC 225 ms
11,172 KB
testcase_09 AC 207 ms
11,568 KB
testcase_10 AC 55 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, Q, T, X, Y;
    cin >> N >> Q;
    vector<int> A(N);
    set<int> S;
    for(int i = 0; i < N; i++){
        cin >> A[i];
        if(A[i] >= 2)S.insert(i);
    }
    S.insert(-1);
    while(Q--){
        cin >> T >> X >> Y;
        if(T == 1){
            X--;
            A[X] = Y;
            if(Y >= 2)S.insert(X);
            else if(S.count(X))S.erase(X);
        }else{
            X--;
            auto it = S.lower_bound(Y);
            it--;
            cout << ((Y - max(X, *it)) & 1 ? 'F' : 'S') << '\n';
        }
    }
}
0