제출 #1067191

#제출 시각아이디문제언어결과실행 시간메모리
1067191duckindogA Difficult(y) Choice (BOI21_books)C++17
10 / 100
2 ms1364 KiB
#include <bits/stdc++.h> #include "books.h" using namespace std; void solve(int n, int k, long long a, int s) { vector<long long> x(n + 1); vector<int> ret; { //consecutive auto get = [&](int l, int r) { long long total = 0; for (int i = l; i <= r; ++i) { if (!x[i]) x[i] = skim(i); total += x[i]; } return total; }; int l = k, r = n; while (l <= r) { int mid = l + r >> 1; auto value = get(mid - k + 1, mid); if (a <= value && value <= 2 * a) { for (int i = mid - k + 1; i <= mid; ++i) ret.push_back(i); answer(ret); return; } if (value < a) l = mid + 1; else r = mid - 1; } } { // k - 1 int total = 0; for (int i = 1; i < k; ++i) { if (!x[i]) x[i] = skim(i); total += x[i]; } auto get = [&](int i) { if (!x[i]) x[i] = skim(i); return total + x[i]; }; int l = k, r = n; while (l <= r) { int mid = l + r >> 1; auto value = get(mid); if (a <= value && value <= 2 * a) { for (int i = mid - k + 1; i <= mid; ++i) ret.push_back(i); answer(ret); return; } if (value < a) l = mid + 1; else r = mid - 1; } } impossible(); }

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

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:23:19: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   23 |       int mid = l + r >> 1;
      |                 ~~^~~
books.cpp:51:19: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   51 |       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...