Submission #551698

#TimeUsernameProblemLanguageResultExecution timeMemory
551698hoanghq2004Gap (APIO16_gap)C++14
0 / 100
28 ms1104 KiB
#include <bits/stdc++.h>
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include "gap.h"

using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;

mt19937 gen(std :: chrono :: system_clock :: now().time_since_epoch().count());

long long a[1000010];

long long findGap(int T, int n) {
    long long L = 0, R = 1e18;
    int lhs = 1, rhs = n;
    while (lhs < rhs) {
        long long *nL, *nR;
        MinMax(L, R, nL, nR);
        L = *nL, R = *nR;
        a[lhs] = L, a[rhs] = R;
        ++lhs, --rhs;
    }
    long long ans = 0;
    for (int i = 1; i < n; ++i) ans = max(ans, a[i + 1] - a[i]);
    return ans;
}

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:23:15: warning: 'nL' may be used uninitialized in this function [-Wmaybe-uninitialized]
   23 |         MinMax(L, R, nL, nR);
      |         ~~~~~~^~~~~~~~~~~~~~
gap.cpp:23:15: warning: 'nR' may be used uninitialized in this function [-Wmaybe-uninitialized]
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...