Submission #591379

#TimeUsernameProblemLanguageResultExecution timeMemory
591379MohamedFaresNebiliGap (APIO16_gap)C++14
70 / 100
65 ms3256 KiB
#include <bits/stdc++.h>
#include "gap.h"
/// #pragma GCC optimize ("Ofast")
/// #pragma GCC target ("avx2")
/// #pragma GCC optimize("unroll-loops")
 
            using namespace std;
 
            using ll = long long;
            using ld = long double;
 
            #define ff first
            #define ss second
            #define pb push_back
            #define all(x) (x).begin(), (x).end()
            #define lb lower_bound
 
            ll findGap(int T, int N) {
                vector<ll> S; ll mn = -1, mx = -1, res = 0;
                MinMax(0ll, 1000000000000000000ll, &mn, &mx);
                ll L = mn, R = mx; ll md = (R - L + N) / N;
                S.push_back(L);
                while(L < R) {
                    MinMax(L + 1, min(R - 1, L + md), &mn, &mx); L += md;
                    if(mn == -1 && mx == -1) continue;
                    S.push_back(mn); S.push_back(mx); 
                }
                S.push_back(R);
                for(int l = 1; l < S.size(); l++)
                    res = max(res, S[l] - S[l - 1]);
                return res;
            }

Compilation message (stderr)

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:29:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |                 for(int l = 1; l < S.size(); l++)
      |                                ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...