結果

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

ソースコード

diff #

#include <bits/stdc++.h>
#define all(v) v.begin(),v.end()
#define eb(v) emplace_back(v)
#define mp(a,b) make_pair(a,b)
#define pc(x) std::bitset<sizeof(x) * 8>(x).count()
#define fast cin.tie(nullptr);ios_base::sync_with_stdio(false)
using namespace std;
using ll = long long;
constexpr ll mod = 998244353;
// constexpr ll mod = 1e9 + 7;
constexpr ll inf = 2e18;
void judge(bool x){
    if(x) cout << "Yes\n";
    else cout << "No\n";
}
int n;
string s;
int main(){
    cin >> n >> s;
    int cnt = 0;
    for(int i = 0; i < n; i++){
        if(s[i] == '(') cnt++;
        else cnt--;
    }
    judge(cnt == 0);
}
0