結果

問題 No.3140 Weird Parentheses Game
コンテスト
ユーザー ZeriToki
提出日時 2025-05-16 21:23:28
言語 C++23
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 630 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,046 ms
コンパイル使用メモリ 335,312 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2026-07-10 17:49:31
合計ジャッジ時間 3,276 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define ll long long
const long long mod=998244353;
const long long hmod=46216567629137;
int main(){
    cin.tie(0)->sync_with_stdio(0);
    cout.tie(0);
    int N;
    string S;
    cin>>N>>S;
    stack<char>st;
    int cnt=0;
    rep(i,N){
        if(S[i]==')'){
            if(!st.empty()){
                st.pop();
                cnt++;
            }
            else st.push(S[i]);
        }
        else{
            st.push(S[i]);
        }
    }
    if(cnt%2==1){
        cout<<"First\n";
    }
    else cout<<"Second\n";
}
0