제출 #549847

#제출 시각아이디문제언어결과실행 시간메모리
549847PherokungA Difficult(y) Choice (BOI21_books)C++14
0 / 100
1 ms208 KiB
#include <bits/stdc++.h> #include "books.h" #define ll long long using namespace std; void solve(int n, int k, long long a, int s){ ll be = 1,ed = n; vector<int> V; while(be <= ed){ ll mid = (be+ed)/2,val; if(skim(mid) > a) ed = mid-1; else be = mid+1; if(ed < k){ impossible(); return; } } V.push_back(0); for(int i=1;i<=k;i++) V.push_back(skim(i)); for(int i=max((ll)k+1,ed-k+1);i<=ed;i++) V.push_back(skim(i)); ll qs[25]; qs[0] = 0; for(int i=1;i<V.size();i++) qs[i] = qs[i-1] + V[i]; vector<int> ANS; for(int i=0;i<V.size();i++){ ll val = qs[i] + (qs[V.size()-1] - qs[V.size()-(k-i+1)]); if(val >= a && val <= 2*a){ for(int j=1;j<=i;j++) ANS.push_back(j); for(int j=(k-i)-1;j>=0;j--) ANS.push_back(ed-j); answer(ANS); return; } } impossible(); }

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

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:10:28: warning: unused variable 'val' [-Wunused-variable]
   10 |         ll mid = (be+ed)/2,val;
      |                            ^~~
books.cpp:26:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |  for(int i=1;i<V.size();i++) qs[i] = qs[i-1] + V[i];
      |              ~^~~~~~~~~
books.cpp:29:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |  for(int i=0;i<V.size();i++){
      |              ~^~~~~~~~~
#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...