제출 #106964

#제출 시각아이디문제언어결과실행 시간메모리
106964golubGap (APIO16_gap)C++14
0 / 100
47 ms2688 KiB
#include "gap.h" #include<bits/stdc++.h> using namespace std; #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define F first #define S second #define pb push_back #define pii pair<long long, long long> #define len(x) (long long)x.size() template<typename A, typename B> bool cmax(A &a, const B &b) { if (a < b) { a = b; return true; } return false; } template<typename A, typename B> bool cmin(A &a, const B &b) { if (a > b) { a = b; return true; } return false; } int askcount = 0; pii ask(long long s, long long t) { askcount++; long long mn = 0, mx = 0; MinMax(s, t, &mn, &mx); return {mn, mx}; } long long findGap(int T, int N) { vector<long long> a(N); long long itr1 = 0, itr2 = N - 1; long long l = -1, r = (long long)1e18 + 1; MinMax(l, r, &l, &r); int dx = (r - l) / (N - 1); int MAX = r; r = l + dx; while (l < MAX) { pii res = ask(l, r); if (res.F != -1) a.pb(res.F); if (res.S != -1) a.pb(res.S); l += dx; r += dx; } long long best = -1; sort(all(a)); // for (auto x: a) cout << x << "\n"; for (int i = 0; i < len(a) - 1; i++) { cmax(best, a[i + 1] - a[i]); } return best; }

컴파일 시 표준 에러 (stderr) 메시지

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:43:12: warning: unused variable 'itr1' [-Wunused-variable]
  long long itr1 = 0, itr2 = N - 1;
            ^~~~
gap.cpp:43:22: warning: unused variable 'itr2' [-Wunused-variable]
  long long itr1 = 0, itr2 = N - 1;
                      ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...