제출 #714872

#제출 시각아이디문제언어결과실행 시간메모리
714872stevancvA Difficult(y) Choice (BOI21_books)C++14
100 / 100
2 ms336 KiB
#include <bits/stdc++.h> #include <books.h> #define ll long long #define ld long double #define sp ' ' #define en '\n' #define smin(a, b) a = min(a, b) #define smax(a, b) a = max(a, b) using namespace std; const int N = 1e5 + 2; const int inf = 1e9; ll val[N]; void solve(int n, int k, ll a, int s) { int l = 1, r = n, idx = r + 1; ll x = -1, y = 0; while (l <= r) { int mid = l + r >> 1; x = skim(mid); if (x >= a) { idx = mid; r = mid - 1; y = x; } else l = mid + 1; } if (idx < k) impossible(); for (int i = 1; i <= k; i++) val[i] = skim(i); if (idx <= n) { for (int i = 1; i <= k - 1; i++) y += val[i]; if (a <= y && y <= a + a) { vector<int> v; for (int i = 1; i <= k - 1; i++) v.push_back(i); v.push_back(idx); answer(v); } } x = 0; for (int i = 1; i <= k; i++) x += val[i]; if (a <= x && x <= a + a) { vector<int> v(k); iota(v.begin(), v.end(), 1); answer(v); } l = 1; r = idx - 1; while (r >= max(k, idx - k)) { ll o = skim(r); x += o - val[l++]; if (a <= x && x <= a + a) { vector<int> v; for (int i = l; i <= k; i++) v.push_back(i); for (int i = r; i <= idx - 1; i++) v.push_back(i); answer(v); } else r--; } impossible(); }

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

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:17:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   17 |         int mid = l + r >> 1;
      |                   ~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...