Submission #523796

#TimeUsernameProblemLanguageResultExecution timeMemory
523796vonatlusGap (APIO16_gap)C++17
0 / 100
26 ms1872 KiB
#include "gap.h"

#pragma GCC optimize("O3")
//#pragma comment(linker, "/STACK:36777216")

#include<bits/stdc++.h>

#define x first
#define y second
#define pb push_back
#define sz(x) (int) x.size()
#define all(z) (z).begin(), (z).end()
 
using namespace std;

using ll = long long;
using pii = pair<int, int>;                                   

const int MOD = 1e9 + 7; 
const int INF = 1e9 + 1e2;
  
long long findGap(int T, int n) {
    vector<ll> a(n);
    ll l = 0, r = 1e18;
    for (int i = 0; i < (n+1)/2; ++i) {
        ll *nl, *nr;
        MinMax(l, r, nl, nr);
        a[i] = *nl;
        a[n-i-1] = *nr;
        l = a[i]+1, r = a[n-i-1]-1;
    }
    ll ans = 0;
    for (int i = 1; i < n; ++i) {
        ans = max(ans, a[i]-a[i-1]);
    }
    return ans;
}

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:27:15: warning: 'nl' may be used uninitialized in this function [-Wmaybe-uninitialized]
   27 |         MinMax(l, r, nl, nr);
      |         ~~~~~~^~~~~~~~~~~~~~
gap.cpp:27:15: warning: 'nr' may be used uninitialized in this function [-Wmaybe-uninitialized]
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...