| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 864820 | tolbi | Homework (CEOI22_homework) | C++17 | 190 ms | 124680 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> ara;
vector<int> son;
string str;
pair<int,int> solve(int l, int r){
if (r-l+1==1){
return {1,n};
}
pair<int,int> lnode=solve(l+4,ara[l]-1);
pair<int,int> rnode=solve(ara[l]+1,son[l]-1);
pair<int,int> don={min(lnode.first,rnode.first),max(lnode.second,rnode.second)};
pair<int,int> orig = don;
if (str[l+1]=='a'){
don.first=lnode.first+rnode.first;
}
else {
int hh = n-lnode.second+1;
int hh2 = n-rnode.second+1;
don.second=n-(hh+hh2)+1;
}
return don;
}
int main(){
cin>>str;
ara.resize(str.length(),-1);
son.resize(str.length(),-1);
n = (str.length()+6)/7;
vector<int> poses;
for (int i = 0; i < str.length(); i++){
if (str[i]=='(') poses.push_back(i-3);
if (str[i]==',') ara[poses.back()]=i;
if (str[i]==')') {
son[poses.back()]=i;
poses.pop_back();
}
}
pair<int,int> ans = solve(0,str.length()-1);
cout<<ans.second-ans.first+1<<endl;
}컴파일 시 표준 에러 (stderr) 메시지
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
