| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1013855 | vjudge1 | 새로운 문제 (POI13_luk) | C++17 | 129 ms | 23468 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//B - Triumphal arch
#include <bits/stdc++.h>
//#define endl '\n'
#define mod 1000000007
using namespace std;
vector<vector<long long>> v(300003);
long long depth[300003], n, nu=0;
bool vis[300003];
void dfs(long long x, long long dep=0)
{
nu=max(nu, dep);
depth[dep]++;
vis[x]=1;
for(long long i=0; i<v[x].size(); i++)
{
long long y=v[x][i];
if(!vis[y])
dfs(y, dep+1);
}
}
long long check(long long x)
{
long long y=0, yo=0;
for(long long i=1; i<=n; i++)
{
yo++;
y+=x;
y-=depth[i];
if(y<0)
{
y*=-1;
if(y%yo==0) x+=y/yo;
else x+=(y+yo)/yo;
y-=yo;
}
}
return x;
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin>>n;
if(n==1)
cout<<0<<endl;
else
{
for(long long i=1; i<n; i++)
{
long long a,b;
cin>>a>>b;
v[a].push_back(b);
v[b].push_back(a);
}
dfs(1);
cout<<check((n-1)/nu)<<endl;
}
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... | ||||
