Submission #127541

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
1275412019-07-09 14:32:09kingfran1907Towns (IOI15_towns)C++14
100 / 100
21 ms1156 KiB
#include "towns.h"
#include <bits/stdc++.h>
using namespace std;
const int maxn = 150;
const int inf = 0x3f3f3f3f;
int qs[maxn][maxn];
int deb = 0;
int n;
int query(int a, int b) {
assert(a < n && b < n && a >= 0 && b >= 0);
if (a > b) swap(a, b);
if (qs[a][b] == -1) qs[a][b] = getDistance(a, b);
return qs[a][b];
}
int a, b;
int B;
bool subtree(int x, int y) {
int xd = (query(a, x) + query(b, x) - query(a, b)) / 2;
int yd = (query(a, y) + query(b, y) - query(a, b)) / 2;
return (xd + yd) > query(x, y);
}
int hubDistance(int n, int sub) {
deb++;
//for (int i = 0; i < n * n; i++) getdistance(0, 1);
::n = n;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:27:31: warning: declaration of 'n' shadows a global declaration [-Wshadow]
 int hubDistance(int n, int sub) {
                               ^
towns.cpp:11:5: note: shadowed declaration is here
 int n;
     ^
towns.cpp:71:7: warning: declaration of 'lef' shadows a previous local [-Wshadow]
   int lef = 0, rig = 0;
       ^~~
towns.cpp:56:6: note: shadowed declaration is here
  int lef = 0, rig = 0;
      ^~~
towns.cpp:71:16: warning: declaration of 'rig' shadows a previous local [-Wshadow]
   int lef = 0, rig = 0;
                ^~~
towns.cpp:56:15: note: shadowed declaration is here
  int lef = 0, rig = 0;
               ^~~
towns.cpp:72:15: warning: declaration of 'v' shadows a previous local [-Wshadow]
   vector<int> v;
               ^
towns.cpp:57:14: note: shadowed declaration is here
  vector<int> v;
              ^
towns.cpp:93:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 1; i < v.size(); i++) {
                  ~~^~~~~~~~~~
towns.cpp:127:18: warning: conversion to 'int' from 'std::vector<int>::size_type {aka long unsigned int}' may alter its value [-Wconversion]
  cnt += buk.size();
                  ^
towns.cpp:27: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...