結果
| 問題 | No.3140 Weird Parentheses Game |
| コンテスト | |
| ユーザー |
nhtloc
|
| 提出日時 | 2025-11-28 11:41:26 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 588 bytes |
| コンパイル時間 | 1,811 ms |
| コンパイル使用メモリ | 194,740 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-11-28 11:41:29 |
| 合計ジャッジ時間 | 3,255 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 WA * 3 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N;
string S;
cin >> N >> S;
int nim_sum = 0;
int depth = 0, max_depth = 0;
for (char c : S) {
if (c == '(') {
depth++;
max_depth = max(max_depth, depth);
} else {
depth--;
if (depth == 0) { // end of one block
nim_sum ^= max_depth;
max_depth = 0;
}
}
}
cout << (nim_sum ? "First" : "Second") << "\n";
return 0;
}
nhtloc