#include <bits/stdc++.h>
#include "fish.h"
using namespace std;
using ll = long long;
ll t[301][301];
ll dp[301][301][301];
ll sum[301][301];
ll max_weights(int N, int M, vector<int> x, vector<int> y, vector<int> w){
ll ans = 0;
for (int i = 0; i < M; i++){
t[x[i]][y[i]] = w[i];
}
for (int i = 0; i < N; i++){
for (int h = 1; h <= 9; h++){
sum[i][h] = t[i][h-1] + sum[i][h-1];
}
if (!i) continue;
for (int a = 0; a <= 9; a++){
for (int b = 0; b <= 9; b++){
for (int c = 0; c <= 9; c++){
ll tmp = dp[i-1][b][c];
if (b > a){
tmp += (sum[i][b] - sum[i][a]);
}
if (a > c && a > b){
tmp += (sum[i-1][a] - sum[i-1][max(b,c)]);
}
// cout << i << " " << a << " " << b << " " << c << " " << tmp << "\n";
dp[i][a][b] = max(dp[i][a][b], tmp);
ans = max(ans, dp[i][a][b]);
}
}
}
}
return ans;
}
/*int main(){
int n;
cin >> n;
int m;
cin >> m;
vector<int> x(m);
vector<int> y(m);
vector<int> w(m);
for (int i = 0; i < m; i++){
cin >> x[i];
cin >> y[i];
cin >> w[i];
}
cout << max_weights(n, m, x, y, w);
return 0;
}
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
47 ms |
24460 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
308 KB |
Output is correct |
2 |
Runtime error |
71 ms |
29712 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
19 ms |
17872 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
468 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
308 KB |
Output is correct |
9 |
Correct |
5 ms |
4928 KB |
Output is correct |
10 |
Correct |
7 ms |
9684 KB |
Output is correct |
11 |
Correct |
4 ms |
4924 KB |
Output is correct |
12 |
Correct |
7 ms |
9676 KB |
Output is correct |
13 |
Correct |
2 ms |
2644 KB |
Output is correct |
14 |
Correct |
6 ms |
9668 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
468 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
308 KB |
Output is correct |
9 |
Correct |
5 ms |
4928 KB |
Output is correct |
10 |
Correct |
7 ms |
9684 KB |
Output is correct |
11 |
Correct |
4 ms |
4924 KB |
Output is correct |
12 |
Correct |
7 ms |
9676 KB |
Output is correct |
13 |
Correct |
2 ms |
2644 KB |
Output is correct |
14 |
Correct |
6 ms |
9668 KB |
Output is correct |
15 |
Incorrect |
8 ms |
9684 KB |
1st lines differ - on the 1st token, expected: '299', found: '9' |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
468 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
308 KB |
Output is correct |
9 |
Correct |
5 ms |
4928 KB |
Output is correct |
10 |
Correct |
7 ms |
9684 KB |
Output is correct |
11 |
Correct |
4 ms |
4924 KB |
Output is correct |
12 |
Correct |
7 ms |
9676 KB |
Output is correct |
13 |
Correct |
2 ms |
2644 KB |
Output is correct |
14 |
Correct |
6 ms |
9668 KB |
Output is correct |
15 |
Incorrect |
8 ms |
9684 KB |
1st lines differ - on the 1st token, expected: '299', found: '9' |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
19 ms |
17872 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
47 ms |
24460 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |