# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
784287 | Lyrically | Towns (IOI15_towns) | C++17 | 14 ms | 884 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<bits/stdc++.h>
#include "towns.h"
using namespace std;
#define pii pair<int,int>
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
int read(){int x;scanf("%d",&x);return x;}
void print(int x){printf("%d\n",x);}
void file(string s)
{
freopen((s+".in").c_str(),"r",stdin);
freopen((s+".out").c_str(),"w",stdout);
}
const int mod=998244353;
int hubDistance(int n,int subtsk)
{
if(subtsk==1)
{
int dis[115][115];
rep(i,n)
{
for(int j=i+1;j<n;j++)
{
int d=getDistance(i,j);
dis[i][j]=dis[j][i]=d;
}
}
int mx=0,l=0,r=0;
rep(i,n)
{
for(int j=i+1;j<n;j++)
{
if(dis[i][j]>mx)
{
mx=dis[i][j];
l=i;
r=j;
}
}
}
//cout<<l<<" "<<r<<" "<<mx<<endl;
int res=(1<<30);
rep(i,n)
{
if(i==l||i==r){continue;}
int fi=dis[i][l],se=dis[i][r];
if((fi+se-mx)&1){continue;}
int inter=(fi+se-mx)/2;
int L=fi-inter,R=se-inter;
res=min(res,max(L,R));
}
return res;
}
return 0;
}
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... |