#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
19 ms |
4864 KB |
Output is correct |
2 |
Correct |
6 ms |
896 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
512 KB |
Output is correct |
2 |
Correct |
14 ms |
3456 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
50 ms |
10104 KB |
Output is correct |
2 |
Runtime error |
366 ms |
65540 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |