結果
| 問題 |
No.3140 Weird Parentheses Game
|
| コンテスト | |
| ユーザー |
forest3
|
| 提出日時 | 2025-05-28 15:08:08 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 468 bytes |
| コンパイル時間 | 1,741 ms |
| コンパイル使用メモリ | 164,624 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-05-28 15:08:12 |
| 合計ジャッジ時間 | 2,950 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 WA * 3 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < n; i++)
int main() {
int N;
string s;
cin >> N >> s;
int l = 0, ma = 0;
vector<int> a;
rep(i, N) {
if(s[i] == '(') {
l++;
ma = max(ma, l);
}
else {
l--;
if(l == 0) {
a.push_back(ma);
ma = 0;
}
}
}
int x = 0, sz = a.size();
rep(i, sz) x ^= a[i];
string ans = "First";
if(x == 0) ans = "Second";
cout << ans << endl;
}
forest3