結果
| 問題 |
No.2080 Simple Nim Query
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2022-09-27 23:41:45 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 647 ms / 3,000 ms |
| コード長 | 505 bytes |
| コンパイル時間 | 792 ms |
| コンパイル使用メモリ | 77,460 KB |
| 最終ジャッジ日時 | 2025-02-07 17:36:36 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 |
ソースコード
#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){
cout << "SF"[(y-*z)%2] << endl;
}else{
cout << "FS"[(y-x)%2] << endl;
}
}
}
}