Submission #965988

# Submission time Handle Problem Language Result Execution time Memory
965988 2024-04-19T08:59:42 Z AdamGS Towns (IOI15_towns) C++17
0 / 100
10 ms 1112 KB
#include "towns.h"
#include<bits/stdc++.h>
using namespace std;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
int hubDistance(int n, int sub) {
  vector<int>A(n), B(n), C(n);
  pair<int,int>ma={0, 0};
  for(int i=1; i<n; ++i) {
    A[i]=getDistance(0, i);
    ma=max(ma, {A[i], i});
  }
  int x=ma.nd;
  B[0]=ma.st;
  for(int i=1; i<n; ++i) if(i!=x) B[i]=getDistance(x, i);
  rep(i, n) C[i]=B[i]-(A[i]+B[i]-B[0])/2;
  ma={0, 0};
  rep(i, n) ma=max(ma, {B[i], i});
  int y=ma.nd;
  int ans=max(C[y], B[y]-C[y]);
  return ans;
}

Compilation message

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:9:28: warning: unused parameter 'sub' [-Wunused-parameter]
    9 | int hubDistance(int n, int sub) {
      |                        ~~~~^~~
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 856 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 856 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 860 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 1112 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 856 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 860 KB Output isn't correct
2 Halted 0 ms 0 KB -