제출 #200820

#제출 시각아이디문제언어결과실행 시간메모리
200820RakhmandGap (APIO16_gap)C++14
83.51 / 100
77 ms3304 KiB
#include "gap.h" #include <cstring> #include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <queue> #include <cmath> #include <cstdlib> #include <ctime> #include <cassert> #include <iterator> using namespace std; typedef long long llong; long long a[100010]; long long ans; set<llong> st; llong n; void get(llong l, llong r){ if(ans > r - l){ return ; } llong sz = (r - l + n - 1) / n; llong last = l; vector<pair<llong, llong> > vec; for(llong tl = l; tl <= r; tl += sz + 1){ llong tr = min(tl + sz, r); llong mn = NULL, mx = NULL; MinMax(tl, tr, &mn, &mx); if(mn == -1){ continue; } ans = max(ans, mn - last); vec.push_back({mn, mx}); last = mx; } for(int i = 0; i < vec.size(); i++){ get(vec[i].first, vec[i].second); } } long long findGap(int T, int N) { n = N; if(T == 1){ int L = 1, R = N; long long l = 0, r = 1e18; while(R >= L){ long long mn = NULL, mx = NULL; MinMax(l, r, &mn, &mx); a[L++] = mn; a[R--] = mx; l = mn + 1; r = mx - 1; } for(int i = 1; i < N; i++){ if(a[i + 1] - a[i] > ans){ ans = a[i + 1] - a[i]; } } return ans; }else{ llong mn = NULL, mx = NULL; MinMax(1, (llong) 1e18, &mn, &mx); get(mn, mx); return ans; } return 0; }

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

gap.cpp: In function 'void get(llong, llong)':
gap.cpp:43:20: warning: converting to non-pointer type 'llong {aka long long int}' from NULL [-Wconversion-null]
         llong mn = NULL, mx = NULL;
                    ^~~~
gap.cpp:43:31: warning: converting to non-pointer type 'llong {aka long long int}' from NULL [-Wconversion-null]
         llong mn = NULL, mx = NULL;
                               ^~~~
gap.cpp:52:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < vec.size(); i++){
                    ~~^~~~~~~~~~~~
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:63:28: warning: converting to non-pointer type 'long long int' from NULL [-Wconversion-null]
             long long mn = NULL, mx = NULL;
                            ^~~~
gap.cpp:63:39: warning: converting to non-pointer type 'long long int' from NULL [-Wconversion-null]
             long long mn = NULL, mx = NULL;
                                       ^~~~
gap.cpp:77:20: warning: converting to non-pointer type 'llong {aka long long int}' from NULL [-Wconversion-null]
         llong mn = NULL, mx = NULL;
                    ^~~~
gap.cpp:77:31: warning: converting to non-pointer type 'llong {aka long long int}' from NULL [-Wconversion-null]
         llong mn = NULL, mx = NULL;
                               ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...