Submission #946410

#TimeUsernameProblemLanguageResultExecution timeMemory
946410n3rm1nGap (APIO16_gap)C++17
0 / 100
56 ms4896 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(mn < mx) { 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, fh[i] - fh[i-1]); ans = max(ans, sh[0] - fh.back()); for (int i = 1; i < sh.size(); ++ i) ans = max(ans, 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:30:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |  for (int i = 1; i < fh.size(); ++ i)
      |                  ~~^~~~~~~~~~~
gap.cpp:33:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |     for (int i = 1; i < sh.size(); ++ i)
      |                     ~~^~~~~~~~~~~
gap.cpp:12:11: warning: 'mn' is used uninitialized in this function [-Wuninitialized]
   12 |  while(mn < mx)
      |        ~~~^~~~
gap.cpp:12:11: warning: 'mx' is used uninitialized in this function [-Wuninitialized]
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...