제출 #933446

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

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

books.cpp: In function 'void solve(long long int, long long int, long long int, long long int)':
books.cpp:42:32: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |     for(long long i = 0; i + k < v.size(); i++)
      |                          ~~~~~~^~~~~~~~~~
/usr/bin/ld: /tmp/cckd9RHp.o: in function `main':
grader.cpp:(.text.startup+0x83): undefined reference to `solve(int, int, long long, int)'
collect2: error: ld returned 1 exit status