結果
| 問題 | No.457 (^^*) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-06-21 20:53:06 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 43 ms / 2,000 ms |
| コード長 | 1,201 bytes |
| 記録 | |
| コンパイル時間 | 2,472 ms |
| コンパイル使用メモリ | 331,316 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-21 20:53:10 |
| 合計ジャッジ時間 | 3,305 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define piii pair<pii, int>
#define pll pair<ll, ll>
#define plll pair<pll, ll>
#define fi first
#define se second
const int N = 2e5 + 5, M = 1e6 + 5;
const int inf = 1e9, mod = 998244353;
const ll INF = 1e18;
namespace ARIS0_0{
string s;
void init(){
}
void solve(){
cin >> s;
int n = s.size(), le = 0, ri = 0;
for (int i = 0; i < n; i ++ ){
if (s[i] != '(') continue;
int cnta = 0;
bool flgl = false;
int cntb = 0;
bool st = false, flgr = false;
for (int j = i + 1; j < n; j ++ ){
if (s[j] == '^'){
cnta ++;
if (st) cntb ++;
if (st && cntb >= 2) flgr = true;
}
else if (s[j] == '*'){
st = true;
if (cnta >= 2) flgl = true;
}
else if (s[j] == ')'){
if (flgl) le ++;
if (flgr) ri ++;
}
}
}
cout << le << " " << ri << "\n";
}
void single(){ init(), solve(); }
void multi(){ init(); int T; cin >> T; while (T -- ) solve(); }
void idmulti(){ init(); int id, T; cin >> id >> T; while (T -- ) solve(); }
};
signed main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ARIS0_0::single();
}
/*
*/