제출 #782934

#제출 시각아이디문제언어결과실행 시간메모리
782934HanksburgerA Difficult(y) Choice (BOI21_books)C++17
컴파일 에러
0 ms0 KiB
#include "books.h" #include <bits/stdc++.h> using namespace std; vector<long long> ans; long long x[100005]; void solve(int n, int k, long long a, int s) { long long l=1, r=n-k+1; while (l<=r) { long long mid=(l+r)/2, sum=0; for (long long i=mid; i<mid+k; i++) { if (!x[i]) x[i]=skim(i); sum+=x[i]; } if (a<=sum && sum<=a*2) { for (long long i=mid; i<mid+k; i++) ans.push_back(i); answer(ans); return; } if (sum<a) l=mid+1; else r=mid-1; } long long pre=0; for (long long i=1; i<k; i++) { if (!x[i]) x[i]=skim(i); pre+=x[i]; } l=k, r=n; while (l<=r) { long long mid=(l+r)/2; if (!x[mid]) x[mid]=skim(mid); if (a<=pre+x[mid] && pre+x[mid]<=a*2) { for (long long i=1; i<k; i++) ans.push_back(i); ans.push_back(mid); answer(ans); return; } if (pre+x[mid]<a) l=mid+1; else r=mid-1; } impossible(); }

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

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:22:20: error: could not convert 'ans' from 'vector<long long int>' to 'vector<int>'
   22 |             answer(ans);
      |                    ^~~
      |                    |
      |                    vector<long long int>
books.cpp:48:20: error: could not convert 'ans' from 'vector<long long int>' to 'vector<int>'
   48 |             answer(ans);
      |                    ^~~
      |                    |
      |                    vector<long long int>