Submission #131922

#TimeUsernameProblemLanguageResultExecution timeMemory
131922faustaadpTowns (IOI15_towns)C++17
0 / 100
62 ms3320 KiB
#include "towns.h" #include<bits/stdc++.h> typedef long long ll; #define pb push_back #define mp make_pair #define fi first #define se second using namespace std; ll i,j,d[1010][1010],jum[1010],p[1010],has; vector<ll> isi[1010]; int hubDistance(int N, int sub) { for(i=0;i<N;i++) for(j=i+1;j<N;j++) { d[i][j]=getDistance(i,j); d[j][i]=d[i][j]; } memset(p,-1,sizeof(p)); for(i=0;i<N;i++) for(j=0;j<N;j++) jum[i]+=d[i][j]; for(i=0;i<N;i++) for(j=i+1;j<N;j++) { ll tem=abs(jum[j]-jum[i]),X,Y; tem/=(N-2); X=(d[i][j]-tem)/2; Y=d[i][j]-X; if(jum[i]>jum[j]) swap(X,Y); //cout<<i<<" "<<j<<" "<<d[i][j]<<" "<<tem<<" "<<X<<" "<<Y<<"\n"; isi[i].pb(X); isi[j].pb(Y); } for(i=0;i<N;i++) { sort(isi[i].begin(),isi[i].end()); has=max(has,isi[i][N-2]); //for(j=0;j<isi[i].size();j++) // cout<<i<<" "<<j<<" "<<isi[i][j]<<"\n"; } return has; }

Compilation message (stderr)

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:16:27: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
    d[i][j]=getDistance(i,j);
                           ^
towns.cpp:16:27: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
towns.cpp:43:9: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
  return has;
         ^~~
towns.cpp:11:28: warning: unused parameter 'sub' [-Wunused-parameter]
 int hubDistance(int N, int sub) 
                            ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...