Submission #286705

#TimeUsernameProblemLanguageResultExecution timeMemory
286705OzyTowns (IOI15_towns)C++17
0 / 100
19 ms896 KiB
#include "towns.h" #include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i = (a); i <= (b); i++) #define debug(a) cerr << #a << " = " << a << endl int largo[112]; int hubDistance(int N, int sub) { int a,b,res,c; rep(i,1,112) largo[i] = 0; a = 0; rep(i,1,N-1) { b = abs(getDistance(0,i)); if (b > a) a = i; } b = 0; rep(i,0,N-1) { if (i != a) { largo[i] = abs(getDistance(a,i)); if (largo[i] > b) b = i; } } res = 1000001; rep(i,0,N-1) { if (i != b && i != a) { c = abs(getDistance(i,b) - largo[i]); if (c < res) res = c; } } return res; }

Compilation message (stderr)

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) {
      |                        ~~~~^~~
towns.cpp:12:24: warning: iteration 111 invokes undefined behavior [-Waggressive-loop-optimizations]
   12 |  rep(i,1,112) largo[i] = 0;
      |               ~~~~~~~~~^~~
towns.cpp:4:39: note: within this loop
    4 | #define rep(i,a,b) for(int i = (a); i <= (b); i++)
      |                                       ^
towns.cpp:12:2: note: in expansion of macro 'rep'
   12 |  rep(i,1,112) largo[i] = 0;
      |  ^~~
#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...