Submission #105322

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
1053222019-04-11 10:01:49Alexa2001Towns (IOI15_towns)C++17
100 / 100
28 ms1024 KiB
#include "towns.h"
#include <bits/stdc++.h>
using namespace std;
const int Nmax = 505;
int x, y;
int D0[Nmax], D1[Nmax], Up[Nmax], L[Nmax];
map< int, vector<int> > gr;
map< pair<int,int> , int > mp;
int getDist(int x, int y)
{
if(x == y) return 0;
if(mp[{x,y}]) return mp[{x, y}];
return mp[{x, y}] = mp[{y, x}] = getDistance(x, y);
}
void prepare(int n)
{
int i;
for(i=0; i<n; ++i) D0[i] = getDist(0, i);
x = max_element(D0, D0+n) - D0;
for(i=0; i<n; ++i) D1[i] = getDist(x, i);
y = max_element(D1, D1+n) - D1;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

towns.cpp: In function 'int getDist(int, int)':
towns.cpp:14:25: warning: declaration of 'y' shadows a global declaration [-Wshadow]
 int getDist(int x, int y)
                         ^
towns.cpp:8:8: note: shadowed declaration is here
 int x, y;
        ^
towns.cpp:14:25: warning: declaration of 'x' shadows a global declaration [-Wshadow]
 int getDist(int x, int y)
                         ^
towns.cpp:8:5: note: shadowed declaration is here
 int x, y;
     ^
towns.cpp: In function 'void prepare(int)':
towns.cpp:26:31: warning: conversion to 'int' from 'long int' may alter its value [-Wconversion]
     x = max_element(D0, D0+n) - D0;
         ~~~~~~~~~~~~~~~~~~~~~~^~~~
towns.cpp:30:31: warning: conversion to 'int' from 'long int' may alter its value [-Wconversion]
     y = max_element(D1, D1+n) - D1;
         ~~~~~~~~~~~~~~~~~~~~~~^~~~
towns.cpp: In function 'bool check(std::vector<int>&, int)':
towns.cpp:38:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(v.size() <= n/2) return 1;
        ~~~~~~~~~^~~~~~
towns.cpp:47:21: warning: declaration of 'x' shadows a global declaration [-Wshadow]
                 int x = lista.back();
                     ^
towns.cpp:8:5: note: shadowed declaration is here
 int x, y;
     ^
towns.cpp:68:13: warning: declaration of 'x' shadows a global declaration [-Wshadow]
         int x = lista.back();
             ^
towns.cpp:8:5: note: shadowed declaration is here
 int x, y;
     ^
towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:122:32: warning: conversion to 'int' from 'std::vector<int>::size_type {aka long unsigned int}' may alter its value [-Wconversion]
         cnt2 -= it.second.size();
                                ^
towns.cpp:127:32: warning: conversion to 'int' from 'std::vector<int>::size_type {aka long unsigned int}' may alter its value [-Wconversion]
         cnt1 += it.second.size();
                                ^
towns.cpp:91:28: warning: unused parameter 'subtask' [-Wunused-parameter]
 int hubDistance(int n, int subtask)
                            ^~~~~~~
#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...