| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 591572 | yutabi | Shortcut (IOI16_shortcut) | C++14 | 2070 ms | 308 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "shortcut.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
typedef long long ll;
typedef pair <int,int> ii;
ll maxi=100000000000000000;
ll best[3000];
ll ans=maxi;
vector <vector <ii> > graph;
void DFS(int node, ll dis=0)
{
best[node]=min(best[node],dis);
for(int i=0;i<graph[node].size();i++)
{
if(best[graph[node][i].second]>dis+graph[node][i].first)
{
DFS(graph[node][i].second,dis+graph[node][i].first);
}
}
}
long long find_shortcut(int n, std::vector<int> l, std::vector<int> d, int c)
{
graph=vector <vector <ii> > (2*n);
for(int i=0;i<n;i++)
{
if(i!=n-1)
{
graph[i].pb(ii(l[i],i+1));
graph[i+1].pb(ii(l[i],i));
}
graph[i].pb(ii(d[i],i+n));
graph[i+n].pb(ii(d[i],i));
}
for(int i=0;i<n;i++)
{
for(int j=i+1;j<n;j++)
{
graph[i].pb(ii(c,j));
graph[j].pb(ii(c,i));
ll maxii=0;
for(int k=0;k<2*n;k++)
{
for(int l=0;l<2*n;l++)
{
best[l]=maxi;
}
DFS(k);
for(int l=0;l<2*n;l++)
{
maxii=max(maxii,best[l]);
}
}
ans=min(ans,maxii);
graph[i].pop_back();
graph[j].pop_back();
}
}
return ans;
}
Compilation message (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... | ||||
