結果
問題 | No.457 (^^*) |
ユーザー | kyabaria |
提出日時 | 2018-09-15 23:06:03 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 134 ms / 2,000 ms |
コード長 | 1,576 bytes |
コンパイル時間 | 1,440 ms |
コンパイル使用メモリ | 166,064 KB |
実行使用メモリ | 4,384 KB |
最終ジャッジ日時 | 2023-09-25 08:52:24 |
合計ジャッジ時間 | 3,851 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,380 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 1 ms
4,376 KB |
testcase_03 | AC | 1 ms
4,380 KB |
testcase_04 | AC | 2 ms
4,376 KB |
testcase_05 | AC | 2 ms
4,380 KB |
testcase_06 | AC | 2 ms
4,380 KB |
testcase_07 | AC | 1 ms
4,380 KB |
testcase_08 | AC | 2 ms
4,380 KB |
testcase_09 | AC | 3 ms
4,376 KB |
testcase_10 | AC | 12 ms
4,380 KB |
testcase_11 | AC | 65 ms
4,380 KB |
testcase_12 | AC | 119 ms
4,384 KB |
testcase_13 | AC | 134 ms
4,380 KB |
testcase_14 | AC | 2 ms
4,380 KB |
testcase_15 | AC | 116 ms
4,380 KB |
testcase_16 | AC | 134 ms
4,380 KB |
testcase_17 | AC | 2 ms
4,376 KB |
testcase_18 | AC | 1 ms
4,380 KB |
testcase_19 | AC | 2 ms
4,376 KB |
ソースコード
#include <bits/stdc++.h> typedef long long ll; #define INF 1000000000 using namespace std; #define MOD 1000000007 int main(void){ string s; cin>>s; int ans_left=0,ans_right=0; for(int i=0;i<s.size()-1;i++){ if(s[i]!='(')continue; int check_left,check_right; check_left=0; check_right=0; string left_face="^^*",right_face="*^^"; int index_left=0,index_right=0; for(int j=i+1;j<s.size();j++){ if(left_face[index_left%3]==s[j])index_left++; if(right_face[index_right%3]==s[j])index_right++; if(index_left>=3 and s[j]==')')ans_left++; if(index_right>=3 and s[j]==')')ans_right++; /* if(s[j]=='*' and check_left==0){ check_left=1; } if(s[j]=='^' and check_left==1){ check_left=2; }if(s[j]=='^' and check_left==2){ check_left=INF; }if(s[j]==')' and check_left==INF){ ans_left++; } if(s[j]=='^' and check_right==0){ check_right=1; }if(s[j]=='^' and check_right==1){ check_right=2; }if(s[j]=='*' and check_right==2){ check_right=INF; }if(s[j]==')' and check_right==INF){ ans_right++; } */ } } cout<<ans_left<<" "<<ans_right<<endl; }