#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
long long max_weights(int n,int m,vector<int>x,vector<int>y,vector<int>w){
long long dp[n+1][11][11]{};
int sum[n+1][11]{};
for(int i = 0; i < m; i++) x[i] += 1;
for(int i = 0; i < m; i++) y[i] += 1;
for(int i = 0; i < m; i++) sum[x[i]][y[i]] += w[i];
long long ans = 0;
for(int i = 0; i < 1; i++){
for(int j = 0; j < 11; j++){
for(int k = 0; k < 11; k++){
dp[i][j][k] = -1e18;
}
}
}
dp[0][0][0] = 0;
for(int i = 1; i <= n; i++){
for(int j = 0; j < 11; j++){
for(int k = 0; k < 11; k++){
for(int v = 0; v < 11; v++){
long long now = dp[i-1][k][j];
int cur = v;
while(cur > max(j,k)) now += sum[i-1][cur--];
cur = k;
while(cur > v) now += sum[i][cur--];
dp[i][v][k] = max(dp[i][v][k],now);
ans = max(ans,now);
}
}
}
}
return ans;
}
// int main(){
// cout << max_weights(5, 4, {0, 1, 4, 3}, {2, 1, 4, 3}, {5, 2, 1, 3}) << '\n';
// }
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
468 ms |
91472 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '25256215083467' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
480 ms |
93268 KB |
1st lines differ - on the 1st token, expected: '40604614618209', found: '49909405972495' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
499 ms |
99668 KB |
Output is correct |
2 |
Correct |
514 ms |
99424 KB |
Output is correct |
3 |
Correct |
493 ms |
90808 KB |
Output is correct |
4 |
Correct |
507 ms |
100692 KB |
Output is correct |
5 |
Correct |
519 ms |
103180 KB |
Output is correct |
6 |
Correct |
544 ms |
102564 KB |
Output is correct |
7 |
Correct |
529 ms |
103248 KB |
Output is correct |
8 |
Correct |
539 ms |
103372 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
856 KB |
Output is correct |
8 |
Correct |
1 ms |
600 KB |
Output is correct |
9 |
Correct |
1 ms |
604 KB |
Output is correct |
10 |
Correct |
3 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
2 ms |
604 KB |
Output is correct |
13 |
Correct |
1 ms |
512 KB |
Output is correct |
14 |
Correct |
2 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
856 KB |
Output is correct |
8 |
Correct |
1 ms |
600 KB |
Output is correct |
9 |
Correct |
1 ms |
604 KB |
Output is correct |
10 |
Correct |
3 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
2 ms |
604 KB |
Output is correct |
13 |
Correct |
1 ms |
512 KB |
Output is correct |
14 |
Correct |
2 ms |
604 KB |
Output is correct |
15 |
Incorrect |
2 ms |
600 KB |
1st lines differ - on the 1st token, expected: '299', found: '250' |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
856 KB |
Output is correct |
8 |
Correct |
1 ms |
600 KB |
Output is correct |
9 |
Correct |
1 ms |
604 KB |
Output is correct |
10 |
Correct |
3 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
2 ms |
604 KB |
Output is correct |
13 |
Correct |
1 ms |
512 KB |
Output is correct |
14 |
Correct |
2 ms |
604 KB |
Output is correct |
15 |
Incorrect |
2 ms |
600 KB |
1st lines differ - on the 1st token, expected: '299', found: '250' |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
499 ms |
99668 KB |
Output is correct |
2 |
Correct |
514 ms |
99424 KB |
Output is correct |
3 |
Correct |
493 ms |
90808 KB |
Output is correct |
4 |
Correct |
507 ms |
100692 KB |
Output is correct |
5 |
Correct |
519 ms |
103180 KB |
Output is correct |
6 |
Correct |
544 ms |
102564 KB |
Output is correct |
7 |
Correct |
529 ms |
103248 KB |
Output is correct |
8 |
Correct |
539 ms |
103372 KB |
Output is correct |
9 |
Incorrect |
528 ms |
103056 KB |
1st lines differ - on the 1st token, expected: '99999', found: '83333' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
468 ms |
91472 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '25256215083467' |
2 |
Halted |
0 ms |
0 KB |
- |