| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1074780 | Unforgettablepl | 참나무 (IOI23_beechtree) | C++17 | 50 ms | 33188 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "beechtree.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> beechtree(int N,int M,vector<int> P,vector<int> C){
vector<int> ans(N);
vector<vector<int>> adj(N);
for(int i=1;i<N;i++)adj[P[i]].emplace_back(i);
function<pair<int,int>(int)> dfs = [&](int x)->pair<int,int>{
vector<bool> contains(3);
int state = -1;
bool works = true;
int maxsize = 0;
for(int&i:adj[x]) {
if(contains[C[i]]) {
works=false;
}
contains[C[i]]=true;
auto [curr,st] = dfs(i);
maxsize=max(st,maxsize);
if(curr==-2) {
works = false;
continue;
}
if(curr==-1)continue;
if(state!=-1 and state!=curr) {
works=false;
continue;
}
state=curr;
}
if(contains[1] and !contains[2]) {
if(state==2)return {-2,max(maxsize,(int)adj[x].size())};
state=1;
}
if(!contains[1] and contains[2]) {
if(state==1)return {-2,max(maxsize,(int)adj[x].size())};
state=2;
}
if(maxsize>adj[x].size())works=false;
if(!works)return {-2,max(maxsize,(int)adj[x].size())};
ans[x]=1;
return {state,max(maxsize,(int)adj[x].size())};
};
dfs(0);
return ans;
}컴파일 시 표준 에러 (stderr) 메시지
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
