# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
718982 | Karuk | Towns (IOI15_towns) | C++14 | 15 ms | 468 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 "towns.h"
#include<bits/stdc++.h>
using namespace std;
map<pair<int,int>,int>m;
map<pair<int,int>,bool>isused;
int getDDD(int x,int y) {
if(isused[{x,y}]==1)return m[{x,y}];
isused[{x,y}]=1;
isused[{y,x}]=1;
m[{x,y}]=getDistance(x,y);
m[{y,x}]=m[{x,y}];
return m[{y,x}];
}
int getmindist(int f,int s,int t) {
int d1=getDDD(f,s);
int d2=getDDD(s,t);
int d3=getDDD(f,t);
int dd=(d1+d2-d3)/2;
int d=(d1+d3-d2)/2;
int ddd=(d2+d3-d1)/2;
return max(max(d,dd),ddd);
}
int hubDistance(int n,int sub) {
int maxd=0,maxind=0;
int md=0;
for(int i=1;i<n;i++) {
int p=getDDD(0,i);
if(maxd<p) {
maxd=p;
maxind=i;
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... |