結果

問題 No.2080 Simple Nim Query
ユーザー CleyLCleyL
提出日時 2022-09-27 23:40:04
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 601 ms / 3,000 ms
コード長 643 bytes
コンパイル時間 861 ms
コンパイル使用メモリ 78,616 KB
実行使用メモリ 12,732 KB
最終ジャッジ日時 2023-09-03 02:50:48
合計ジャッジ時間 5,275 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 304 ms
4,376 KB
testcase_04 AC 309 ms
4,376 KB
testcase_05 AC 601 ms
12,732 KB
testcase_06 AC 427 ms
5,464 KB
testcase_07 AC 428 ms
5,412 KB
testcase_08 AC 531 ms
10,844 KB
testcase_09 AC 519 ms
10,860 KB
testcase_10 AC 401 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <set>
using namespace std;
int main(){
  int n,q;cin>>n>>q;
  set<int> A;
  A.insert(-1);
  for(int i = 0; n > i; i++){
    int x;cin>>x;
    if(x != 1)A.insert(i);
  }
  for(int i = 0; q > i; i++){
    int t,x,y;cin>>t>>x>>y;
    if(t==1){
      if(y == 1)A.erase(--x);
      else A.insert(--x);
    }else{
      auto z = --A.lower_bound(y);
      if(*z >= x-1){
        if((y-*z)%2){
          cout << "F" << endl;
        }else{
          cout << "S" << endl;
        }
      }else{
        if((y-x)%2){
          cout << "S" << endl;
        }else{
          cout << "F" << endl;
        }
      }
    }
  }
}
0