| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 719300 | XJP12 | 경주 (Race) (IOI11_race) | C++14 | 0 ms | 212 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
vi vis;
vector<vector<pair<int,int>>> g;
ll sum=0;
int opt;
int len=0;
vi indeg;
vi order;
int k1;
bool ban=false;
void dfs(int u){
vis[u]=true;
for(auto v: g[u]){
if(!vis[v.first]){
if(ban==false) order.push_back(v.first);
sum+=v.second;
//cout<<sum<<endl;
len++;
if(sum==k1) opt=min(opt,len);
dfs(v.first);
}
}
}
int best_path(int n, int k, int h[][2], int l[]){
opt=n;
k1=k;
vis.resize(n,0);
indeg.resize(n,0);
vector<pair<int,int>> p;
g.resize(n,p);
for(int i=0; i<n-1; i++){
g[h[i][0]].push_back(make_pair(h[i][1],l[i]));
g[h[i][1]].push_back(make_pair(h[i][0],l[i]));
indeg[h[i][0]]++;
indeg[h[i][1]]++;
}
int root;
for(int i=0; i<n-1; i++){
if(indeg[i]==1) root=i;
}
for(int i=0; i<n-1; i++){
sum=0;
vis.resize(n,0);
dfs(root);
ban=true;
root=order[i];
}
return opt;
}
컴파일 시 표준 에러 (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... | ||||
