제출 #551786

#제출 시각아이디문제언어결과실행 시간메모리
551786hoanghq2004Gap (APIO16_gap)C++14
100 / 100
63 ms2372 KiB
#include <bits/stdc++.h> #pragma GCC optimize ("O3") #pragma GCC optimize ("unroll-loops") #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include "gap.h" using namespace __gnu_pbds; using namespace std; template <typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>; mt19937 gen(std :: chrono :: system_clock :: now().time_since_epoch().count()); long long a[1000010]; long long findGap(int T, int n) { if (T == 1) { long long L = 0, R = 1e18; int lhs = 1, rhs = n; while (lhs <= rhs) { long long temp1 = 0, temp2 = 0; long long *nL = &temp1, *nR = &temp2; MinMax(L, R, nL, nR); L = *nL, R = *nR; a[lhs] = L, a[rhs] = R; ++L, --R; ++lhs, --rhs; } long long ans = 0; for (int i = 1; i < n; ++i) ans = max(ans, a[i + 1] - a[i]); return ans; } else { long long L = 0, R = 1e18, x, y; MinMax(L, R, &x, &y); L = x, R = y; vector <long long> a = {L}; long long gap = (R - L) / (n - 1); for (++L; L < R && a.size() <= n; L += gap + 1) { long long x, y; MinMax(L, L + gap, &x, &y); if (x != -1 && y != -1) { a.push_back(x); if (x != y) a.push_back(y); } } a.push_back(R); long long ans = 0; for (int i = 1; i < a.size(); ++i) ans = max(ans, a[i] - a[i - 1]); return ans; } }

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

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:40:37: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   40 |         for (++L; L < R && a.size() <= n; L += gap + 1) {
      |                            ~~~~~~~~~^~~~
gap.cpp:50:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |         for (int i = 1; i < a.size(); ++i) ans = max(ans, a[i] - a[i - 1]);
      |                         ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...