Submission #633922

#TimeUsernameProblemLanguageResultExecution timeMemory
633922fadi57Gap (APIO16_gap)C++14
0 / 100
25 ms1104 KiB
#include<bits/stdc++.h> #include "gap.h" using namespace std; typedef long long ll; const ll inf =1e18; const ll mod=998244353; ll findGap(int T, int N){ ll mn=0; ll mx=1e18; MinMax( 0, mx, &mn, &mx); ll st=mn;ll en=mx; ll len=(mx-(mn+1))/(N-1); ll last=mn; vector<ll>v; v.push_back(mn); for(ll i=mn+1;i<mx;i+=len){ MinMax( i, min(i+len-1,mx-1), &mn, &mx); if(mn!=-1){ v.push_back(mn); v.push_back(mx); } } v.push_back(en); ll ans=len; for(int i=1;i<v.size();i++){ ans=max(ans,v[i]-v[i-1]); } return ans; }

Compilation message (stderr)

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:27:14: 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<v.size();i++){
      |             ~^~~~~~~~~
gap.cpp:11:4: warning: unused variable 'st' [-Wunused-variable]
   11 | ll st=mn;ll en=mx;
      |    ^~
gap.cpp:13:4: warning: unused variable 'last' [-Wunused-variable]
   13 | ll last=mn;
      |    ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...