Submission #863666

#TimeUsernameProblemLanguageResultExecution timeMemory
863666Cyber_WolfA Difficult(y) Choice (BOI21_books)C++17
0 / 100
3060 ms696 KiB
#include <bits/stdc++.h> #include "books.h" #ifdef CYBER #include "grader.cpp" #endif #define lg long long using namespace std; const lg N = 2e5+5; lg v[N], n,k, a, s; vector<int> ans, cur; bool solve(lg idx, lg sum = 0) { if(cur.size() > k) return false; if(sum > 2*a) return false; if(idx > n) { if(sum <= 2*a && sum >= a) { ans = cur; return true; } return false; } cur.push_back(idx); if(solve(idx+1, sum+v[idx])) { return true; } cur.pop_back(); if(solve(idx+1, sum)) return true; return false; } void solve(int N, int K, long long A, int S) { n = N; k = K; a = A; s = S; for(int i = 1; i <= N; i++) { v[i] = skim(i); } solve(1); if(ans.empty()) impossible(); answer(ans); impossible(); }

Compilation message (stderr)

books.cpp: In function 'bool solve(long long int, long long int)':
books.cpp:17:19: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   17 |     if(cur.size() > k)  return false;
      |        ~~~~~~~~~~~^~~
#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...