Submission #1199518

#TimeUsernameProblemLanguageResultExecution timeMemory
1199518sula2Gap (APIO16_gap)C++20
0 / 100
10 ms1096 KiB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include "gap.h"
#define bitcount __builtin_popcount
#define all(a) a.begin(), a.end()
using namespace std;
using namespace chrono;
using namespace __gnu_pbds;
template<typename T> using ordered_set = tree<T,null_type,less_equal<>,rb_tree_tag,tree_order_statistics_node_update>;

long long findGap(int t, int n) {
    long long mn = -1, mx = 1e18+1;
    vector<long long> a;
    while (mn != -1) {
        MinMax(mn + 1, mx - 1, &mn, &mx);
        if (mn == -1) break;
        a.push_back(mn);
        a.push_back(mx);
    }
    sort(all(a));
    long long res = 0;
    for (int i = 1; i < a.size(); i++)
        res = max(res, a[i] - a[i-1]);
    return res;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...