제출 #863663

#제출 시각아이디문제언어결과실행 시간메모리
863663Cyber_WolfA Difficult(y) Choice (BOI21_books)C++17
0 / 100
32 ms1228 KiB
#include <bits/stdc++.h> #include "books.h" #ifdef CYBER #include "grader.cpp" #endif #define lg long long using namespace std; void solve(int N, int K, long long A, int S) { vector<lg> v(N); for(int i = 1; i <= N; i++) { v[i] = skim(i); } vector<int> ans; for(int i = 0; i+K-1 <= N; i++) { vector<int> cur(K); lg sum = 0; for(int j = 0; j < K; j++) cur[j] = i+j, sum += v[cur[j]]; while(sum <= 2*A) { if(sum >= A) { ans = cur; break; } if(i == N) break; priority_queue<array<lg, 2>> q; q.push({v[i+K]-v[i+K-1], K-1}); // cout << sum << '\n'; while(q.size() && sum < A) { lg u = q.top()[1]; q.pop(); sum += v[cur[u]+1]-v[cur[u]]; // for(auto it : cur) cout << it << ' '; // cout << '\n'; cur[u]++; if(u+1 == cur.size() || cur[u+1] != cur[u]+1) { if(cur[u]+1 <= N) q.push({v[cur[u]+1]-v[cur[u]], u}); } if(u-1 >= 0 && cur[u]-cur[u-1] == 2) { q.push({v[cur[u-1]+1]-v[cur[u-1]], u-1}); } } cout << "\n\n"; } } if(ans.empty()) impossible(); answer(ans); impossible(); }

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

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:43:24: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |                 if(u+1 == cur.size() || cur[u+1] != cur[u]+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...