Submission #360961

#TimeUsernameProblemLanguageResultExecution timeMemory
360961juggernautTowns (IOI15_towns)C++14
25 / 100
20 ms1388 KiB
#include "towns.h" #include <iostream> using namespace std; long long int n; long long int map[500][500]; int hubDistance(int N, int sub) { int st=0; n=N; int b=0,ma=0; for(int i=0;i<n;i++) { map[0][i]=getDistance(0, i); if(map[0][i]>ma) { b=i; ma=map[0][i]; } } int e=0; ma=0; for(int i=0;i<=n;i++) { map[b][i]=getDistance(b, i); if(map[b][i]>ma) { e=i; ma=map[b][i]; } } for(int i=0;i<n;i++) { map[e][i]=getDistance(e, i); } long long int ans=99999999999999; for(int i=0;i<n;i++) { int c=map[b][i]+map[e][i]-map[b][e]; c/=2; ans=min(ans,max(map[e][i]-c,map[b][i]-c)); } return ans; }

Compilation message (stderr)

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:16:15: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   16 |    ma=map[0][i];
      |       ~~~~~~~~^
towns.cpp:27:15: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   27 |    ma=map[b][i];
      |       ~~~~~~~~^
towns.cpp:37:28: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   37 |   int c=map[b][i]+map[e][i]-map[b][e];
      |         ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
towns.cpp:41:9: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   41 |  return ans;
      |         ^~~
towns.cpp:7:6: warning: unused variable 'st' [-Wunused-variable]
    7 |  int st=0;
      |      ^~
towns.cpp:6:28: warning: unused parameter 'sub' [-Wunused-parameter]
    6 | 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...