結果
| 問題 |
No.2080 Simple Nim Query
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-27 02:55:57 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 683 ms / 3,000 ms |
| コード長 | 687 bytes |
| コンパイル時間 | 2,197 ms |
| コンパイル使用メモリ | 200,240 KB |
| 最終ジャッジ日時 | 2025-02-07 16:50:17 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main () {
int N, Q;
cin >> N >> Q;
set<int> st;
st.insert(1000);
for (int i = 1; i <= N; i ++) {
int a;
cin >> a;
if (a > 1) {
st.insert(-i);
}
}
for (int q = 0;q < Q; q ++) {
int t, x, y;
cin >> t >> x >> y;
if (t == 1) {
if (y > 1) {
st.insert(-x);
} else if (st.find(-x) != st.end()) {
st.erase(-x);
}
} else {
int pk = -(*st.lower_bound(-y));
int d = min(y - x, y - pk);
cout << (d % 2 ? "S" : "F") << endl;
}
}
}