結果
| 問題 | No.3143 Colorless Green Parentheses Sleep Furiously | 
| コンテスト | |
| ユーザー |  Cecil | 
| 提出日時 | 2025-05-16 22:30:21 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 535 bytes | 
| コンパイル時間 | 1,985 ms | 
| コンパイル使用メモリ | 194,440 KB | 
| 実行使用メモリ | 6,272 KB | 
| 最終ジャッジ日時 | 2025-05-17 00:32:33 | 
| 合計ジャッジ時間 | 13,451 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 WA * 2 | 
| other | AC * 8 WA * 7 RE * 34 | 
ソースコード
#include<iostream>
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    string S;
    cin >> N;
    cin >> S;
    if (N%2==1){
        cout << "No" << endl;
        return 0;
    }
    vector<char> stack;
    for (int i=0; i<N; i++){
        if (!stack.empty() && stack.back()=='(' && S[i]==')'){
            stack.pop_back();
        } else {
            stack.push_back(S[i]);
        }
    }
    if (stack.empty()){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}
            
            
            
        