Submission #629638

#TimeUsernameProblemLanguageResultExecution timeMemory
629638Cyber_WolfGap (APIO16_gap)C++14
0 / 100
22 ms1096 KiB
//Contest: APIO 16 Problem 3 //Problem Name: Gap #include <bits/stdc++.h> #include "gap.h" using namespace std; long long findGap(int subtask, int n) { vector<long long> v1, v2; long long first = 0, last = 1e18; for(int i = 0; i < n; i++) { long long mnm, mxm; MinMax(first, last, &mnm, &mxm); v1.push_back(mnm); if(first >= last) break; if(mnm == mxm) break; v2.push_back(mxm); last = mnm+1; first = mxm-1; } long long ans = 0; for(int i = 1; i < v1.size(); i++) ans = max(ans, v1[i]-v1[i-1]); if(v2.size()) { ans = max(ans, v2.front()-v1.back()); } for(int i = 1; i < v2.size(); i++) { ans = max(ans, v2[i]-v2[i-1]); } return ans; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:27:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |  for(int i = 1; i < v1.size(); i++) ans = max(ans, v1[i]-v1[i-1]);
      |                 ~~^~~~~~~~~~~
gap.cpp:32:19: 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 < v2.size(); i++)
      |                 ~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...