# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
89321 | vvash17 | 새로운 문제 (POI13_luk) | C++14 | 2071 ms | 23968 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <vector>
#include <map>
using namespace std;
vector<int> graph[300001];
int city_num,from,to;
int evaluate_result(int search_start,int &need_num,int been_there[]){
int available_neigbours = 0;
int sub_tree_res = 0;
been_there[search_start]++;
for(int i = 0; i<graph[search_start].size(); i++){
if(been_there[graph[search_start][i]] == 0){
available_neigbours++;
sub_tree_res += evaluate_result(graph[search_start][i],need_num,been_there);
}
}
int res = available_neigbours-(need_num-sub_tree_res);
if(res < 0)return 0;
return res;
}
int search_init(int &need_num){
int been_there[city_num+1] = {0};
return evaluate_result(1,need_num,been_there);
}
int main() {
scanf("%d",&city_num);
for(int i = 1; i<city_num; i++){
cin>>from>>to;
graph[from].push_back(to);
graph[to].push_back(from);
}
int result = 0;
for(int need_num = 0; need_num<=city_num; need_num++){
result = search_init(need_num);
if(result == 0){
result = need_num;
break;
}
}
cout<<result<<endl;
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |