# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
886691 |
2023-12-12T16:30:13 Z |
vjudge1 |
San (COCI17_san) |
C++17 |
|
60 ms |
456 KB |
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define ONLINE_JUDGE
void solve() {
int n;
i64 k;
cin >> n >> k;
vector <int> h(n), g(n);
for(int i = 0; i < n; i++) {
cin >> h[i] >> g[i];
}
int ans = 0;
for(int mask = 0; mask < (1 << n); mask++) {
int last = 0;
i64 sum = 0;
bool ok = true;
for(int i = 0; i < n; i++) {
if(mask & (1 << i)) {
if(h[i] < last) {
ok = false;
break;
}
last = h[i];
sum += g[i];
}
}
ans += (sum >= k && ok);
}
cout << ans;
return;
}
signed main() {
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int t = 1; //cin >> t;
for(int i = 1; i <= t; i++) {
solve();
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
60 ms |
348 KB |
Output is correct |
2 |
Correct |
12 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
456 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
452 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |