Submission #946414

#TimeUsernameProblemLanguageResultExecution timeMemory
946414n3rm1nGap (APIO16_gap)C++17
0 / 100
29 ms3908 KiB
/// gap #include<bits/stdc++.h> #include "gap.h" using namespace std; long long findGap(int T, int N) { long long s = 0, t = (long long)(1e18); long long mn, mx; vector < long long > fh, sh; while(s < t) { ///cout << mn << " " << mx << endl; MinMax(s, t, &mn, &mx); if(mn == -1)break; if(mn == mx) { fh.push_back(mn); break; } if(mn > mx)break; fh.push_back(mn); sh.push_back(mx); s = mn + 1; t = mx - 1; } reverse(sh.begin(), sh.end()); long long ans = 0; for (int i = 1; i < fh.size(); ++ i) ans = max(ans, 1LL * (fh[i] - fh[i-1])); ans = max(ans, 1LL * (sh[0] - fh.back())); for (int i = 1; i < sh.size(); ++ i) ans = max(ans, 1LL * (sh[i] - sh[i-1])); //cout << ans << endl; return ans; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:29:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |  for (int i = 1; i < fh.size(); ++ i)
      |                  ~~^~~~~~~~~~~
gap.cpp:32:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     for (int i = 1; i < sh.size(); ++ i)
      |                     ~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...