Submission #106032

#TimeUsernameProblemLanguageResultExecution timeMemory
106032OpenTheWindowGap (APIO16_gap)C++14
0 / 100
67 ms2288 KiB
#include<iostream> #include<string> #include<set> #include<utility> #include<vector> #include<map> #include<algorithm> #include<queue> #include<stack> #include<bits/stdc++.h> #include"gap.h" using namespace std; long long findGap(int T, int N){ long long ans = 0; if(T == 1){ vector<long long> a; long long s = 0, t = 1000000000000000000LL; while (true) { long long mn, mx; if(s > t) break; MinMax(s, t, &mn, &mx); if(mn == -1) break; if(mn < mx){ a.push_back(mn); a.push_back(mx); s = mn + 1; t = mx - 1; } if(mn == mx){ a.push_back(mn); break; } } assert(a.size() == N); sort(a.begin(), a.end()); for(int i=0; i<N-1; i++){ ans = max(ans, a[i+1] - a[i]); } } return ans; }

Compilation message (stderr)

In file included from /usr/include/c++/7/cassert:44:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:33,
                 from gap.cpp:11:
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:47:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   assert(a.size() == N);
          ~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...