# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28975 | 2017-07-18T02:34:30 Z | 서규호 (지각충1)(#1231) | Take-out (POI13_usu) | C++14 | 89 ms | 22100 KB |
#include <bits/stdc++.h> #include <unistd.h> #define pii pair<int,int> #define pll pair<lld,lld> #define pb push_back #define next nextt #define lld long long #define Inf 1000000000 #define Linf 1000000000000000000LL #define get gett using namespace std; int N,ans; int lev[300002],cnt[300002]; bool check[300002]; vector<int> edge[300002]; void dfs(int x){ check[x] = true; for(auto &i : edge[x]){ if(check[i]) continue; lev[i] = lev[x]+1; dfs(i); } } bool can(lld x){ for(int i=1; i<=N; i++){ if(x*i < cnt[i]) return false; } return true; } int main(){ scanf("%d",&N); for(int i=1; i<N; i++){ int x,y; scanf("%d %d",&x,&y); edge[x].pb(y); edge[y].pb(x); } dfs(1); for(int i=2; i<=N; i++) cnt[lev[i]]++; for(int i=1; i<=N; i++) cnt[i] += cnt[i-1]; int l,r; l = 0; r = N-1; while(l <= r){ int m = (l+r)/2; if(can(m)){ ans = m; r = m-1; }else l = m+1; } printf("%d\n",ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 11688 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 11688 KB | Integer 109 violates the range [1, 100] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 11688 KB | Integer 1199 violates the range [1, 1195] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 11848 KB | Integer 7993 violates the range [1, 3998] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 9 ms | 13140 KB | Integer 119999 violates the range [1, 119995] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 19 ms | 14420 KB | Integer 220087 violates the range [1, 220067] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 46 ms | 16980 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 46 ms | 22100 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 89 ms | 22100 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |