Submission #313136

#TimeUsernameProblemLanguageResultExecution timeMemory
313136nandonathanielGap (APIO16_gap)C++14
0 / 100
80 ms2720 KiB
#include "gap.h" #include "bits/stdc++.h" using namespace std; long long findGap(int T, int N) { vector<long long> kiri,kanan; long long ki=0,ka=1e18,mn,mx; for(int i=1;i<=(N+1)/2;i++){ MinMax(ki,ka,&mn,&mx); kiri.push_back(mn); if(mn!=mx)kanan.push_back(mx); ki=mn+1;ka=mx-1; } reverse(kanan.begin(),kanan.end()); for(auto isi : kanan)kiri.push_back(isi); for(auto isi : kiri)cout << isi << " "; cout << '\n'; long long ans=0; for(int i=1;i<kiri.size();i++)ans=max(ans,kiri[i]-kiri[i-1]); return ans; }

Compilation message (stderr)

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