Submission #82565

#TimeUsernameProblemLanguageResultExecution timeMemory
82565Leonardo_PaesSan (COCI17_san)C++11
48 / 120
81 ms516 KiB
#include <bits/stdc++.h> using namespace std; #define MAXN 25 int h[MAXN], g[MAXN]; int main(){ int n; long long s; cin >> n >> s; for(int i=1; i<=n; i++){ cin >> h[i] >> g[i]; } long long ans=0; for(int i=0; i<(1<<n); i++){ int u = i; int ant=0; bool ok=1; long long sum = 0; for(int j=1; j<=20; j++){ if(u%2==1){ if(h[j]>=h[ant]){ sum+=g[j]; ant=j; } else{ ok=0; break; } } u = u/2; } if(ok==1){ if(sum>=s){ ans++; } } } cout << ans << endl; return 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...