| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 203240 | MKopchev | 새로운 문제 (POI13_luk) | C++14 | 311 ms | 21256 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
컴파일 시 표준 에러 (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... | ||||
