Submission #660475

#TimeUsernameProblemLanguageResultExecution timeMemory
660475Danilo21Gap (APIO16_gap)C++14
0 / 100
58 ms3260 KiB
#include <bits/stdc++.h> #include "gap.h" #define ll long long #define ld long double #define pb push_back #define fi first #define se second #define en '\n' #define sp ' ' #define tb '\t' #define ri(n) int n; cin >> n #define rl(n) ll n; cin >> n #define rs(s) string s; cin >> s #define rc(c) char c; cin >> c #define rv(v) for (auto &x : v) cin >> x #define pven(v) for (auto x : v) cout << x << en #define pv(v) for (auto x : v) cout << x << sp; cout << en #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define yes cout << "YES" << en #define no cout << "NO" << en #define smin(a, b) a = min(a, b) #define smax(a, b) a = max(a, b) #define ssort(a, b) if (a < b) swap(a, b) #define bitcnt(a) (__builtin_popcountll(a)) #define bithigh(a) (63-__builtin_clzll(a)) #define lg bithigh #define highpow(a) (1LL << (ll)lg(a)) using namespace std; const ll LINF = 1e18; const int mxN = 1e6+10, INF = 2e9; ll n, m, a[mxN], b[2][mxN]; ll findGap(int T, int N){ vector<ll> a; ll L = 0, R = LINF, l, r; if (T == 1){ while (a.size() < N){ MinMax(L, R, &l, &r); a.pb(l); a.pb(r); L = l+1; R = r-1; } } else{ MinMax(0, LINF, &L, &R); a.pb(L); a.pb(R); L++; R--; ll d = (R-L+1) / max(1, N-2); r = L-1; while (r < R){ l = r+1; r = l+d-1; if (R-r < d) r = R; ll mn, mx; MinMax(l, r, &mn, &mx); if (~mn){ a.pb(mn); a.pb(mx); } } } sort(all(a)); ll d = a[1] - a[0]; for (int i = 2; i < N; i++) smax(d, a[i] - a[i-1]); return d; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:42:25: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   42 |         while (a.size() < N){
      |                ~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...