Submission #715437

#TimeUsernameProblemLanguageResultExecution timeMemory
715437studyGap (APIO16_gap)C++17
30 / 100
52 ms2248 KiB
#include <bits/stdc++.h> #include "gap.h" using ll = long long; using namespace std; long long findGap(int T, int N){ ll pmini = 0, pmaxi = 1e18+2; vector<ll> ans; bool ok1 = 0, ok2 = 0; for (int i=0; i<(N+1)/2; ++i){ long long a,b; MinMax(pmini,pmaxi,&a,&b); ans.emplace_back(a); ans.emplace_back(b); pmini = a+1; pmaxi = b-1; } sort(ans.begin(),ans.end()); ans.erase(unique(ans.begin(),ans.end()),ans.end()); ll res = 0; for (int i=1; i<ans.size(); ++i){ res = max(res,ans[i]-ans[i-1]); } return res; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:21:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |  for (int i=1; i<ans.size(); ++i){
      |                ~^~~~~~~~~~~
gap.cpp:9:7: warning: unused variable 'ok1' [-Wunused-variable]
    9 |  bool ok1 = 0, ok2 = 0;
      |       ^~~
gap.cpp:9:16: warning: unused variable 'ok2' [-Wunused-variable]
    9 |  bool ok1 = 0, ok2 = 0;
      |                ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...