# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28978 | 2017-07-18T02:42:02 Z | 서규호 (지각충1)(#1231) | Take-out (POI13_usu) | C++14 | 73 ms | 22020 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]; queue<int> q; void bfs(int x){ check[x] = true; q.push(x); while(!q.empty()){ int v = q.front(); q.pop(); for(auto &i : edge[v]){ if(check[i]) continue; check[i] = true; lev[i] = lev[v]+1; q.push(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); } bfs(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)>>1; 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 | 11692 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 11692 KB | Integer 109 violates the range [1, 100] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 11692 KB | Integer 1199 violates the range [1, 1195] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 11824 KB | Integer 7993 violates the range [1, 3998] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 9 ms | 13060 KB | Integer 119999 violates the range [1, 119995] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 16 ms | 14340 KB | Integer 220087 violates the range [1, 220067] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 39 ms | 16900 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 | 43 ms | 22020 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 | 73 ms | 22020 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |