Submission #1071717

#TimeUsernameProblemLanguageResultExecution timeMemory
1071717VMaksimoski008San (COCI17_san)C++17
48 / 120
60 ms408 KiB
#include <bits/stdc++.h> //#define int long long using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; const int mod = 1e9 + 7; const int LOG = 20; const int maxn = 1e5 + 5; signed main() { ll n, T, ans = 0; cin >> n >> T; vector<ll> h(n), g(n); for(int i=0; i<n; i++) cin >> h[i] >> g[i]; for(int s=1; s<(1<<n); s++) { ll sum = 0, last = -1, ok = 1; for(int i=0; i<n; i++) { if(s & (1 << i)) { sum += g[i]; if(last > -1 && h[last] > h[i]) ok = 0; last = i; } } if(ok) ans += (sum >= T); } cout << ans << '\n'; 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...