Submission #461151

#TimeUsernameProblemLanguageResultExecution timeMemory
461151vanicIce Hockey World Championship (CEOI15_bobek)C++14
40 / 100
1087 ms296 KiB
#include <iostream> #include <cstdio> #include <cmath> #include <algorithm> #include <vector> using namespace std; typedef long long ll; const int maxn=45; ll a[maxn]; ll pref[maxn]; ll sol; void rijesi(int x, ll sum){ if(sum<0){ return; } if(sum>=pref[x+1]){ sol+=(1ll<<(x+1)); return; } sol++; for(int i=x; i>-1; i--){ rijesi(i-1, sum-a[i]); } } int main(){ int n; ll m; scanf("%d%lld", &n, &m); for(int i=0; i<n; i++){ scanf("%lld", a+i); } sort(a, a+n); for(int i=0; i<n; i++){ pref[i+1]=pref[i]+a[i]; } rijesi(n-1, m); printf("%lld\n", sol); return 0; }

Compilation message (stderr)

bobek.cpp: In function 'int main()':
bobek.cpp:34:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   34 |  scanf("%d%lld", &n, &m);
      |  ~~~~~^~~~~~~~~~~~~~~~~~
bobek.cpp:36:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   36 |   scanf("%lld", a+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...