Submission #624427

#TimeUsernameProblemLanguageResultExecution timeMemory
624427socpiteGap (APIO16_gap)C++14
0 / 100
61 ms3276 KiB
#include "gap.h" #include<bits/stdc++.h> using namespace std; #define f first #define s second typedef long long ll; ll ans = 0; int n; void solve(ll l, ll r){ if(r-l <= ans)return; ll dist = (r-l+n)/n; vector<pair<ll, ll>> A; for(ll i = l; i+=dist; i <= r){ pair<ll, ll> tmp; MinMax(i, min(i+dist-1, r), &tmp.f, &tmp.s); A.push_back(tmp); } for(int i = 1; i < A.size(); i++){ if(A[i-1].f != -1 && A[i].f != -1)ans = max(ans, A[i].f - A[i-1].s); } for(auto v: A)solve(v.f, v.s); } long long findGap(int T, int N) { n = N; solve(0, 1e18); return ans; }

Compilation message (stderr)

gap.cpp: In function 'void solve(ll, ll)':
gap.cpp:18:30: warning: for increment expression has no effect [-Wunused-value]
   18 |     for(ll i = l; i+=dist; i <= r){
      |                            ~~^~~~
gap.cpp:23:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for(int i = 1; i < A.size(); i++){
      |                    ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...