# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
203240 | 2020-02-19T21:46:53 Z | MKopchev | Triumphal arch (POI13_luk) | C++14 | 311 ms | 21256 KB |
#include<bits/stdc++.h> using namespace std; const int nmax=3e5+42; int n; vector<int> adj[nmax]; int seen[nmax]; void dfs(int node,int parent,int h) { seen[h]++; for(auto k:adj[node]) if(k!=parent)dfs(k,node,h+1); } bool can(int current) { int sum=0; for(int i=1;i<=n;i++) { sum=sum+seen[i]; if(1LL*i*current<sum)return 0; } return 1; } int main() { scanf("%i",&n); int u,v; for(int i=1;i<n;i++) { scanf("%i%i",&u,&v); adj[u].push_back(v); adj[v].push_back(u); } dfs(1,0,0); int ok=n-1,not_ok=-1; while(ok-not_ok>1) { int av=(ok+not_ok)/2; if(can(av))ok=av; else not_ok=av; } printf("%i\n",ok); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 7416 KB | Output is correct |
2 | Correct | 9 ms | 7416 KB | Output is correct |
3 | Incorrect | 9 ms | 7416 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 9 ms | 7416 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 10 ms | 7420 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 10 ms | 7416 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 14 ms | 7800 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 24 ms | 8696 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 72 ms | 11896 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 180 ms | 16572 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 288 ms | 21256 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 311 ms | 21212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |