結果

問題 No.2080 Simple Nim Query
ユーザー 👑 CleyL
提出日時 2022-09-27 23:53:45
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 411 bytes
コンパイル時間 1,827 ms
コンパイル使用メモリ 199,292 KB
最終ジャッジ日時 2025-02-07 17:36:48
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 1 WA * 7
権限があれば一括ダウンロードができます

ソースコード

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