結果
問題 |
No.3142 Balancing with O=>X Flip
|
ユーザー |
![]() |
提出日時 | 2025-05-26 17:51:39 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 362 bytes |
コンパイル時間 | 2,205 ms |
コンパイル使用メモリ | 192,440 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-05-26 17:51:43 |
合計ジャッジ時間 | 3,250 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
other | AC * 25 |
ソースコード
#include <bits/stdc++.h> using namespace std; void fast_io() { ios::sync_with_stdio(false); std::cin.tie(nullptr); } int main() { fast_io(); int n; cin >> n; string s; cin >> s; int cnt = 0; for (char c : s) { if (c == '(') { cnt++; } else { cnt--; } if (cnt < 0) { cout << "No" << endl; return 0; } } cout << "Yes" << endl; }