結果

問題 No.3141 Balancing with X=>O Flip
ユーザー Nauclhlt🪷
提出日時 2025-03-05 16:49:19
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 329 bytes
コンパイル時間 1,600 ms
コンパイル使用メモリ 195,244 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-05-17 03:12:13
合計ジャッジ時間 2,530 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main()
{
	int N;
    cin >> N;
    string S;
    cin >> S;

    assert(S.size() == N);

    int open = 0;
    int close = 0;
    for (int i = 0; i < N; i++)
    {
        if (S[i] == '(') open++;
        else close++;
    }

    cout << (open == close ? "Yes" : "No") << endl;
}
0