Submission #235138

# Submission time Handle Problem Language Result Execution time Memory
235138 2020-05-27T07:22:36 Z NONAME San (COCI17_san) C++17
96 / 120
366 ms 65540 KB
#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
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 4864 KB Output is correct
2 Correct 6 ms 896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 512 KB Output is correct
2 Correct 14 ms 3456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory 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)