#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 100;
const int maxl = 11;
int n;
ll dp[maxn][maxl][maxl];
ll a[maxn][maxl];
long long max_weights(int N, int M, vector<int> X, vector<int> Y, vector<int> W){
n = N;
for(int i = 0; i < M; i++){
X[i]++; Y[i]++;
a[X[i]][Y[i]] += W[i];
}
for(int i = 1; i <= n; i++){
for(int j = 1; j <= 10; j++){
a[i][j] += a[i][j-1];
}
}
for(int c = 1; c <= n + 1; c++){
for(int i = 0; i <= 10; i++){
for(int j = 0; j <= 10; j++){
dp[c][i][j] = -(ll)1e18;
if(c == 1 && i == 0) dp[c][i][j] = 0;
}
}
}
for(int c = 2; c <= n + 1; c++){
for(int i = 0; i <= 10; i++){
for(int j = 0; j <= 10; j++){
for(int k = 0; k <= 10; k++){
ll x = dp[c-1][i][j];
if(max(i, k) > j){
x += a[c-1][max(i, k)] - a[c-1][j];
}
dp[c][j][k] = max(dp[c][j][k], x);
}
}
}
}
ll ans = 0;
for(int i = 0; i <= 10; i++){
ans = max(ans, dp[n+1][i][0]);
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
192 ms |
95316 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '25256215083467' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
210 ms |
97244 KB |
1st lines differ - on the 1st token, expected: '40604614618209', found: '49909405972495' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
199 ms |
103508 KB |
Output is correct |
2 |
Correct |
200 ms |
103508 KB |
Output is correct |
3 |
Correct |
190 ms |
95404 KB |
Output is correct |
4 |
Correct |
203 ms |
105040 KB |
Output is correct |
5 |
Correct |
235 ms |
107592 KB |
Output is correct |
6 |
Correct |
230 ms |
106980 KB |
Output is correct |
7 |
Correct |
233 ms |
107468 KB |
Output is correct |
8 |
Correct |
245 ms |
107600 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
600 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
600 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
604 KB |
Output is correct |
15 |
Incorrect |
1 ms |
604 KB |
1st lines differ - on the 1st token, expected: '299', found: '250' |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
600 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
604 KB |
Output is correct |
15 |
Incorrect |
1 ms |
604 KB |
1st lines differ - on the 1st token, expected: '299', found: '250' |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
199 ms |
103508 KB |
Output is correct |
2 |
Correct |
200 ms |
103508 KB |
Output is correct |
3 |
Correct |
190 ms |
95404 KB |
Output is correct |
4 |
Correct |
203 ms |
105040 KB |
Output is correct |
5 |
Correct |
235 ms |
107592 KB |
Output is correct |
6 |
Correct |
230 ms |
106980 KB |
Output is correct |
7 |
Correct |
233 ms |
107468 KB |
Output is correct |
8 |
Correct |
245 ms |
107600 KB |
Output is correct |
9 |
Incorrect |
215 ms |
107256 KB |
1st lines differ - on the 1st token, expected: '99999', found: '83333' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
192 ms |
95316 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '25256215083467' |
2 |
Halted |
0 ms |
0 KB |
- |