This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define ft first
#define sd second
using namespace std;
typedef long long ll;
int n, h[50];
ll k, g[50], ans;
map <ll, ll> sum[50];
int main() {
cin >> n >> k;
for (int i = 0; i < n; i++)
cin >> h[i] >> g[i], sum[i][min(g[i], k)] = 1;
for (int i = 0; i < n; i++)
for (int j = i + 1; j < n; j++) {
if (h[i] > h[j])
continue;
for (auto sm : sum[i])
sum[j][min(k, sm.ft + g[j])] += sm.sd;
}
for (int i = 0; i < n; i++)
ans += sum[i][k];
cout << ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |