Submission #1121658

#TimeUsernameProblemLanguageResultExecution timeMemory
1121658vjudge1Ice Hockey World Championship (CEOI15_bobek)C++11
0 / 100
1121 ms717952 KiB
#include <bits/stdc++.h> #define GOOD_LUCK ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define int long long #define itn int #define Int int #define INF -1000000 #define MOD 1000000007 #define endl "\n" #define ff first #define ss second #define all(v) v.begin(), v.end() using namespace std; int temp; int n; vector <int> v; vector <int> sums; void build(int i, int sum) { if (i == n) { sums.push_back(sum); return; } build(i+1, sum); build(i+1, sum + v[i]); } signed main() { GOOD_LUCK int t; t = 1; // cin >> t; while (t--) { int m, s=0, cnt=0, k=0; cin >> n >> m; for (int i=0; i < n; i++) { cin >> temp; if (temp < m) { v.push_back(temp); k+=temp; } if (temp == m) s++; } n = v.size(); build(0, 0); sort(sums.begin(), sums.end()); int l = 1, r = sums.size(), ans=0; while (l <= r) { int mid = (l + r) / 2; if (sums[mid] <= m) { ans = mid; l = mid + 1; } else r = mid - 1; } cout << ans + 1 + s; } return 0; } // Problem B // by Ekber_Ekber

Compilation message (stderr)

bobek.cpp: In function 'int main()':
bobek.cpp:36:18: warning: unused variable 'cnt' [-Wunused-variable]
   36 |      int m, s=0, cnt=0, k=0;
      |                  ^~~
#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...