結果

問題 No.2080 Simple Nim Query
ユーザー CleyLCleyL
提出日時 2022-09-27 23:58:54
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 540 ms / 3,000 ms
コード長 411 bytes
コンパイル時間 2,012 ms
コンパイル使用メモリ 209,088 KB
実行使用メモリ 12,800 KB
最終ジャッジ日時 2024-06-12 07:28:45
合計ジャッジ時間 6,316 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,816 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 278 ms
6,940 KB
testcase_04 AC 287 ms
6,940 KB
testcase_05 AC 540 ms
12,800 KB
testcase_06 AC 400 ms
6,944 KB
testcase_07 AC 409 ms
6,940 KB
testcase_08 AC 465 ms
11,008 KB
testcase_09 AC 483 ms
11,008 KB
testcase_10 AC 373 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int n,q,t,x,y;
int main(){
  cin>>n>>q;
  set<int> A;
  A.insert(-1);
  for(;n>y;y++){
    cin>>x;
    if(--x)A.insert(y);
  }
  while(q--){
    cin>>t>>x>>y;
    if(--t){
      auto z=--A.lower_bound(y);
      if(*z>x-2)cout << "SF"[(y-*z)%2] << endl;
      else cout << "FS"[(y-x)%2] << endl;
    }else{
      A.insert(--x);
      if(!--y)A.erase(x);
    }
  }
}
0