Submission #467957

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
4679572021-08-25 17:57:07nonsensenonsense1Fun Tour (APIO20_fun)C++17
0 / 100
1 ms256 KiB
#include "fun.h"
#include <algorithm>
#include <vector>
const int N = 100000;
std::pair<int, int> dist[2][N];
bool u[N];
std::vector<int> createFunTour(int n, int q)
{
int v0, v1, d = 0;
for (int i = 1; i < n; ++i) {
int cur = hoursRequired(0, i);
if (cur > d) {
v0 = i;
d = cur;
}
}
d = 0;
for (int i = 0; i < n; ++i) {
dist[0][i] = std::make_pair(hoursRequired(v0, i), i);
if (dist[0][i].first > d) {
v1 = i;
d = dist[0][i].first;
}
}
for (int i = 0; i < n; ++i) dist[1][i] = std::make_pair(hoursRequired(v1, i), i);
std::sort(dist[0], dist[0] + n);
std::sort(dist[1], dist[1] + n);
std::vector<int> ans;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

fun.cpp: In function 'std::vector<int> createFunTour(int, int)':
fun.cpp:27:71: warning: 'v1' may be used uninitialized in this function [-Wmaybe-uninitialized]
   27 |  for (int i = 0; i < n; ++i) dist[1][i] = std::make_pair(hoursRequired(v1, i), i);
      |                                                          ~~~~~~~~~~~~~^~~~~~~
fun.cpp:21:44: warning: 'v0' may be used uninitialized in this function [-Wmaybe-uninitialized]
   21 |   dist[0][i] = std::make_pair(hoursRequired(v0, i), i);
      |                               ~~~~~~~~~~~~~^~~~~~~
#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...