Submission #598338

#TimeUsernameProblemLanguageResultExecution timeMemory
5983388e7Gap (APIO16_gap)C++17
30 / 100
53 ms2240 KiB
//Challenge: Accepted #pragma GCC optimize("Ofast") #include <bits/stdc++.h> #include "gap.h" using namespace std; #ifdef zisk void debug(){cout << endl;} template<class T, class ... U> void debug(T a, U ... b){cout << a << " ", debug(b...);} template<class T> void pary(T l, T r) { while (l != r) cout << *l << " ", l++; cout << endl; } #else #define debug(...) 0 #define pary(...) 0 #endif #define ll long long #define maxn 50005 #define pii pair<int, int> #define ff first #define ss second #define io ios_base::sync_with_stdio(0);cin.tie(0); ll findGap(int T, int N) { ll ret = 0; if (T == 1) { vector<ll> a; ll low = 0, up = 1e18, vl, vr; while (low < up && a.size() < N) { MinMax(low, up, &vl, &vr); if (vl == -1) break; a.push_back(vl); a.push_back(vr); low = vl+1, up = vr-1; } sort(a.begin(), a.end()); a.resize(int(unique(a.begin(), a.end()) - a.begin())); for (int i = 1;i < N;i++) ret = max(ret, a[i] - a[i-1]); } else { } return ret; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:28:31: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   28 |   while (low < up && a.size() < N) {
      |                      ~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...