結果

問題 No.457 (^^*)
ユーザー face4face4
提出日時 2018-07-23 16:29:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 991 bytes
コンパイル時間 610 ms
コンパイル使用メモリ 71,436 KB
実行使用メモリ 7,876 KB
最終ジャッジ日時 2023-08-28 13:41:46
合計ジャッジ時間 4,690 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 3 ms
4,376 KB
testcase_08 AC 17 ms
4,376 KB
testcase_09 AC 128 ms
4,380 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
using namespace std;

int main(){
    string s;
    cin >> s;

    vector<int> leftParen, rightParen;
    for(int i = 0; i < s.length(); i++){
        if(s[i] == '(') leftParen.push_back(i);
        if(s[i] == ')') rightParen.push_back(i);
    }

    int left = 0, right = 0;
    for(int x : leftParen){
        for(int y : rightParen){
            if(y < x)   continue;
            bool asta = false;
            int wedge = 0;
            for(int z = x+1; z < y; z++){
                if(s[z] == '*') asta = true;
                if(s[z] == '^' && asta) wedge++;
            }
            if(asta && wedge >= 2)  right++;
            
            asta = false;
            wedge = 0;
            for(int z = y-1; z > x; z--){
                if(s[z] == '*') asta = true;
                if(s[z] == '^' && asta) wedge++;
            }
            if(asta && wedge >= 2)  left++;
        }
    }

    cout << left << " " << right << endl;

    return 0;
}
0