結果
| 問題 |
No.457 (^^*)
|
| コンテスト | |
| ユーザー |
taba
|
| 提出日時 | 2017-05-18 07:16:25 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 994 ms / 2,000 ms |
| コード長 | 1,312 bytes |
| コンパイル時間 | 786 ms |
| コンパイル使用メモリ | 76,608 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-18 18:29:03 |
| 合計ジャッジ時間 | 3,721 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
#include <cstdio>
#include <cstring>
#include <random>
#include <vector>
#include <algorithm>
#include <array>
#include <functional>
#include <utility>
using namespace std;
int main(){
char s[10001];
-scanf("%s",s);
int end=0,count[]={0,0};
while(s[end])end++;
vector<int> startpos,yama,aste,endpos;
for(int i=0;i<end;i++){
if(s[i]=='(')
startpos.push_back(i);
if(s[i]=='^')
yama.push_back(i);
if(s[i]=='*')
aste.push_back(i);
if(s[i]==')')
endpos.push_back(i);
}
for(int a:startpos){
for(auto e=upper_bound(endpos.begin(),endpos.end(),a);e<endpos.end();e++){
bool flag=true;
//left ^^*
for(auto y1=upper_bound(yama.begin(),yama.end(),a);y1<yama.end()&&*y1<*e&&flag;y1++){
for(auto y2=upper_bound(y1,yama.end(),*y1);y2<yama.end()&&*y2<*e&&flag;y2++){
if(any_of(aste.begin(),aste.end(),[e,y2](int x){return *y2<x&&x<*e;})){
flag=false;
}
}
}
flag||count[0]++;
flag=true;
//right *^^
for(auto as=upper_bound(aste.begin(),aste.end(),a);as<aste.end()&&*as<*e&&flag;as++){
for(auto y1=upper_bound(yama.begin(),yama.end(),*as);y1<yama.end()&&*y1<*e&&flag;y1++){
if(any_of(y1+1,yama.end(),[e](int x){return x<*e;})){
flag=false;
}
}
}
flag||count[1]++;
}
}
printf("%d %d\n",count[0],count[1]);
return 0;
}
taba