結果
問題 | No.3141 Balancing with X=>O Flip |
ユーザー |
![]() |
提出日時 | 2025-05-16 21:59:22 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 378 bytes |
コンパイル時間 | 3,441 ms |
コンパイル使用メモリ | 274,080 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-05-17 03:14:13 |
合計ジャッジ時間 | 4,485 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
ソースコード
#include <bits/stdc++.h> int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; std::cin >> n; if (n & 1) { std::cout << "No\n"; } else { int cnt = 0; std::string s; std::cin >> s; for (int i = 0; i < n; i++) { cnt += s[i] == '('; cnt -= s[i] == ')'; } std::cout << (cnt == 0 ? "Yes\n" : "No\n"); } }