# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
89303 | 2018-12-11T17:25:27 Z | vvash17 | Triumphal arch (POI13_luk) | C++14 | 2000 ms | 35304 KB |
#include <cstdio> #include <vector> #include <algorithm> #include <map> #include <iostream> #include <set> using namespace std; map<int,vector<int> > graph; 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){ if(need_num <= 1)return -1; if(need_num == 1)return need_num; int been_there[city_num]; for(int i = 0; i<city_num; i++)been_there[i] = 0; return evaluate_result(1,need_num,been_there); } int main() { scanf("%d",&city_num); for(int i = 1; i<city_num; i++){ scanf("%d %d", &from, &to); graph[from].push_back(to); graph[to].push_back(from); } int result = 1; for(int need_num = 1; need_num<=city_num; need_num++){ result = search_init(need_num); if(result == 0){ result = need_num; break; } } printf("%d \n",&result); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 508 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 508 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 528 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 64 ms | 1492 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 307 ms | 3924 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1203 ms | 12064 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2033 ms | 23492 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2033 ms | 35304 KB | Time limit exceeded |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2054 ms | 35304 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |