結果
問題 | No.457 (^^*) |
ユーザー |
|
提出日時 | 2019-03-28 18:01:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 92 ms / 2,000 ms |
コード長 | 832 bytes |
コンパイル時間 | 831 ms |
コンパイル使用メモリ | 89,888 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-15 19:05:57 |
合計ジャッジ時間 | 1,936 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#include <limits> #include <iostream> #include <algorithm> #include <iomanip> #include <map> #include <set> #include <queue> #include <stack> #include <numeric> #include <bitset> static const int MOD = 1000000007; using ll = int64_t; using u32 = uint32_t; using namespace std; template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208; int main() { string s, t = "^^*-", u = "*^^-"; cin >> s; int n = s.size(); int ans1 = 0, ans2 = 0; for (int i = 0; i < n; ++i) { if(s[i] != '(') continue; int cnt1 = 0, cnt2 = 0; for (int j = i+1; j < n; ++j) { if(t[cnt1] == s[j]) cnt1++; if(u[cnt2] == s[j]) cnt2++; if(s[j] == ')') ans1 += (cnt1 == 3), ans2 += (cnt2 == 3); } } cout << ans1 << " " << ans2 << "\n"; return 0; }