結果
| 問題 |
No.2080 Simple Nim Query
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2022-09-27 23:58:54 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 594 ms / 3,000 ms |
| コード長 | 411 bytes |
| コンパイル時間 | 2,171 ms |
| コンパイル使用メモリ | 199,264 KB |
| 最終ジャッジ日時 | 2025-02-07 17:37:11 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 |
ソースコード
#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);
}
}
}