제출 #660477

#제출 시각아이디문제언어결과실행 시간메모리
660477Danilo21Gap (APIO16_gap)C++14
89.04 / 100
64 ms3276 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) / (N-1); 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 < a.size(); i++) smax(d, a[i] - a[i-1]); return d; }

컴파일 시 표준 에러 (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){
      |                ~~~~~~~~~^~~
gap.cpp:66:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   66 |     for (int i = 2; i < a.size(); i++)
      |                     ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...