Submission #163878

#TimeUsernameProblemLanguageResultExecution timeMemory
163878KubalionzzaleGap (APIO16_gap)C++14
30 / 100
67 ms3440 KiB
#include "gap.h" #include <vector> #include <algorithm> #include <assert.h> #include <iostream> long long findGap(int T, int n) { long long int minValue = 0, maxValue = 1e18; std::vector<long long int> vec; if (T == 1) { long long int left = 0, right = 0; do { MinMax(minValue, maxValue, &left, &right); if (left != -1) vec.push_back(left); if (right != left) vec.push_back(right); minValue = left + 1; maxValue = right - 1; } while (minValue <= maxValue && left != -1 && right != -1 && vec.size() < n); std::sort(vec.begin(), vec.end()); long long int maxi = 0; for (int i = 1; i < vec.size(); ++i) { if (vec[i] - vec[i - 1] > maxi) maxi = vec[i] - vec[i - 1]; } return maxi; } else { } }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:26:82: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         } while (minValue <= maxValue && left != -1 && right != -1 && vec.size() < n);
                                                                       ~~~~~~~~~~~^~~
gap.cpp:30:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i = 1; i < vec.size(); ++i)
                         ~~^~~~~~~~~~~~
gap.cpp:42:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...