# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
157325 | 2019-10-10T17:03:14 Z | karma | 스트랩 (JOI14_straps) | C++14 | 26 ms | 16120 KB |
#include<bits/stdc++.h> #define FileName "test" #define ll long long #define pb emplace_back #define deg first #define c second using namespace std; typedef pair<int, int> pii; const int N = int(2e3) + 2; const int oo = int(2e9) + 7; int f[N][N], a[N]; int n, res = 0, nxt; pii val[N]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if(fopen(FileName".inp", "r")) { freopen(FileName".inp", "r", stdin); freopen(FileName".out", "w", stdout); } cin >> n; for(int i = 1; i <= n; ++i) cin >> val[i].deg >> val[i].c; sort(val + 1, val + n + 1); for(int i = 1; i <= n; ++i) { for(int j = 0; j <= n; ++j) { f[i][j] = max(f[i - 1][j], (j ? f[i - 1][min(j - 1 + val[i].deg, n)] + val[i].c: 0)); } } cout << f[n][1]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 380 KB | Output is correct |
11 | Correct | 2 ms | 380 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 380 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 2 ms | 376 KB | Output is correct |
20 | Correct | 2 ms | 376 KB | Output is correct |
21 | Correct | 2 ms | 380 KB | Output is correct |
22 | Correct | 2 ms | 380 KB | Output is correct |
23 | Correct | 2 ms | 380 KB | Output is correct |
24 | Correct | 2 ms | 376 KB | Output is correct |
25 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 760 KB | Output is correct |
3 | Correct | 2 ms | 760 KB | Output is correct |
4 | Correct | 2 ms | 760 KB | Output is correct |
5 | Correct | 2 ms | 760 KB | Output is correct |
6 | Correct | 2 ms | 760 KB | Output is correct |
7 | Correct | 2 ms | 760 KB | Output is correct |
8 | Correct | 10 ms | 8184 KB | Output is correct |
9 | Correct | 10 ms | 8184 KB | Output is correct |
10 | Correct | 10 ms | 8184 KB | Output is correct |
11 | Correct | 10 ms | 8188 KB | Output is correct |
12 | Correct | 23 ms | 15968 KB | Output is correct |
13 | Correct | 23 ms | 15992 KB | Output is correct |
14 | Correct | 23 ms | 15992 KB | Output is correct |
15 | Correct | 23 ms | 15992 KB | Output is correct |
16 | Correct | 23 ms | 15992 KB | Output is correct |
17 | Correct | 23 ms | 15992 KB | Output is correct |
18 | Correct | 23 ms | 15992 KB | Output is correct |
19 | Correct | 23 ms | 15992 KB | Output is correct |
20 | Correct | 26 ms | 15992 KB | Output is correct |
21 | Correct | 23 ms | 15992 KB | Output is correct |
22 | Correct | 23 ms | 16092 KB | Output is correct |
23 | Correct | 24 ms | 15992 KB | Output is correct |
24 | Correct | 23 ms | 15996 KB | Output is correct |
25 | Correct | 23 ms | 16120 KB | Output is correct |
26 | Correct | 23 ms | 15996 KB | Output is correct |
27 | Correct | 23 ms | 15992 KB | Output is correct |
28 | Correct | 23 ms | 16120 KB | Output is correct |
29 | Correct | 23 ms | 15992 KB | Output is correct |
30 | Correct | 23 ms | 15992 KB | Output is correct |
31 | Correct | 23 ms | 15992 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 760 KB | Output is correct |
2 | Correct | 2 ms | 760 KB | Output is correct |
3 | Correct | 2 ms | 760 KB | Output is correct |
4 | Correct | 2 ms | 760 KB | Output is correct |
5 | Correct | 2 ms | 760 KB | Output is correct |
6 | Correct | 2 ms | 760 KB | Output is correct |
7 | Correct | 2 ms | 760 KB | Output is correct |
8 | Correct | 2 ms | 760 KB | Output is correct |
9 | Correct | 10 ms | 8184 KB | Output is correct |
10 | Correct | 10 ms | 8184 KB | Output is correct |
11 | Correct | 10 ms | 8184 KB | Output is correct |
12 | Correct | 11 ms | 8184 KB | Output is correct |
13 | Correct | 10 ms | 8184 KB | Output is correct |
14 | Correct | 11 ms | 8184 KB | Output is correct |
15 | Correct | 10 ms | 8184 KB | Output is correct |
16 | Correct | 10 ms | 8184 KB | Output is correct |
17 | Correct | 23 ms | 15992 KB | Output is correct |
18 | Correct | 26 ms | 15996 KB | Output is correct |
19 | Correct | 23 ms | 15992 KB | Output is correct |
20 | Correct | 23 ms | 15992 KB | Output is correct |
21 | Correct | 23 ms | 15992 KB | Output is correct |
22 | Correct | 23 ms | 15992 KB | Output is correct |
23 | Correct | 23 ms | 15992 KB | Output is correct |
24 | Correct | 23 ms | 15992 KB | Output is correct |
25 | Correct | 23 ms | 15996 KB | Output is correct |
26 | Correct | 23 ms | 15992 KB | Output is correct |
27 | Correct | 23 ms | 15992 KB | Output is correct |
28 | Correct | 23 ms | 15992 KB | Output is correct |
29 | Correct | 23 ms | 15992 KB | Output is correct |
30 | Correct | 23 ms | 15992 KB | Output is correct |
31 | Correct | 23 ms | 15992 KB | Output is correct |
32 | Correct | 23 ms | 16120 KB | Output is correct |
33 | Correct | 23 ms | 15964 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 16120 KB | Output is correct |
2 | Correct | 23 ms | 15996 KB | Output is correct |
3 | Correct | 23 ms | 16088 KB | Output is correct |
4 | Correct | 23 ms | 16092 KB | Output is correct |
5 | Correct | 23 ms | 15992 KB | Output is correct |
6 | Correct | 23 ms | 15992 KB | Output is correct |
7 | Correct | 24 ms | 15992 KB | Output is correct |
8 | Correct | 23 ms | 16120 KB | Output is correct |
9 | Correct | 23 ms | 16080 KB | Output is correct |
10 | Correct | 23 ms | 15996 KB | Output is correct |
11 | Correct | 23 ms | 15992 KB | Output is correct |
12 | Correct | 23 ms | 15992 KB | Output is correct |
13 | Correct | 23 ms | 15992 KB | Output is correct |
14 | Correct | 23 ms | 16120 KB | Output is correct |
15 | Correct | 24 ms | 15964 KB | Output is correct |
16 | Correct | 23 ms | 15996 KB | Output is correct |
17 | Correct | 23 ms | 16120 KB | Output is correct |
18 | Correct | 23 ms | 15992 KB | Output is correct |
19 | Correct | 23 ms | 16052 KB | Output is correct |
20 | Correct | 23 ms | 16060 KB | Output is correct |
21 | Correct | 23 ms | 16120 KB | Output is correct |
22 | Correct | 23 ms | 16120 KB | Output is correct |
23 | Correct | 23 ms | 16120 KB | Output is correct |
24 | Correct | 23 ms | 16028 KB | Output is correct |
25 | Correct | 23 ms | 16120 KB | Output is correct |