結果
| 問題 |
No.3141 Balancing with X=>O Flip
|
| ユーザー |
it_is_a_pity_
|
| 提出日時 | 2025-05-16 21:25:26 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 632 bytes |
| コンパイル時間 | 4,378 ms |
| コンパイル使用メモリ | 250,312 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-05-17 03:13:27 |
| 合計ジャッジ時間 | 4,781 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 |
ソースコード
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define all(v) v.begin(),v.end()
const ll INF = (ll)2e18;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
ll N;
string S;
cin >> N >> S;
if(N%2==1){
cout << "No" << endl;
return 0;
}
ll cnt = 0;
rep(i,N){
if(S[i]=='('){
cnt++;
}
}
if(cnt!=N-cnt){
cout << "No" << endl;
return 0;
}
cout << "Yes" << endl;
}
it_is_a_pity_