Submission #785320

#TimeUsernameProblemLanguageResultExecution timeMemory
785320ymmTowns (IOI15_towns)C++17
0 / 100
13 ms400 KiB
#include "towns.h" #include <bits/stdc++.h> #define Loop(x,l,r) for (ll x = (l); x < (r); ++x) #define LoopR(x,l,r) for (ll x = (r)-1; x >= (l); --x) typedef std::pair<int,int> pii; typedef long long ll; using namespace std; const int N = 120; int dis0[N], disa[N], disb[N]; int dis[N][N]; int get(int i, int j) { if (i == j) return 0; if (i > j) swap(i, j); if (!dis[i][j]) dis[i][j] = getDistance(i, j); return dis[i][j]; } int hubDistance(int n, int sub) { Loop (i,0,n) dis0[i] = get(0, i); int a = max_element(dis0, dis0+n) - dis0; Loop (i,0,n) disa[i] = get(a, i); int b = max_element(disa, disa+n) - disa; Loop (i,0,n) disb[i] = get(b, i); int ans = 1e9; Loop (i,0,n) { int x = (disa[i] + disa[b] - disb[i])/2; int y = (disb[i] + disb[a] - disa[i])/2; ans = min(ans, max(x, y)); } return ans; }

Compilation message (stderr)

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:27:20: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   27 |   dis0[i] = get(0, i);
      |                    ^
towns.cpp:28:36: warning: conversion from 'long int' to 'int' may change value [-Wconversion]
   28 |  int a = max_element(dis0, dis0+n) - dis0;
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
towns.cpp:30:20: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   30 |   disa[i] = get(a, i);
      |                    ^
towns.cpp:31:36: warning: conversion from 'long int' to 'int' may change value [-Wconversion]
   31 |  int b = max_element(disa, disa+n) - disa;
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
towns.cpp:33:20: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   33 |   disb[i] = get(b, i);
      |                    ^
towns.cpp:25:28: warning: unused parameter 'sub' [-Wunused-parameter]
   25 | 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...