Submission #65766

#TimeUsernameProblemLanguageResultExecution timeMemory
65766GoogalIce Hockey World Championship (CEOI15_bobek)C++14
40 / 100
1135 ms1049600 KiB
#include <algorithm> #include <iostream> #include <vector> using namespace std; typedef long long ll; const int NMAX = 25; int n; ll v[NMAX]; ll m, res; vector < ll > a1; vector < ll > a2; void solve(int pos, int lim, ll sum, vector < ll > &a) { if(pos == lim) { a.push_back(sum); return; } solve(pos + 1, lim, sum, a); solve(pos + 1, lim, sum + v[pos], a); } int main() { ios::sync_with_stdio(false); cin >> n >> m; for(int i = 0; i < n; i++) cin >> v[i]; solve(0, n / 2, 0, a1); sort(a1.begin(), a1.end()); solve(n / 2, n, 0, a2); sort(a2.begin(), a2.end()); int val = a2.size() - 1; for(int i = 0; i < a1.size(); ++i) { if(m < a1[i]) break; while(a2[val] > m - a1[i] && 0 <= val) val--; res += val; res++; } cout << res << '\n'; return 0; }

Compilation message (stderr)

bobek.cpp: In function 'int main()':
bobek.cpp:44:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 0; i < a1.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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...