#include "closing.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n;
int qs[3030];
ll qsx[3030], qsy[3030], qsmx[3030];
ll vx[3030], vy[3030];
int max_score(int N, int X, int Y, ll K, vector<int> U, vector<int> V, vector<int> W) {
n = N;
int x = X + 1, y = Y + 1;
for (int i = 1;i < n;i++) {
qs[i] = qs[i - 1] + W[i - 1];
}
for (int i = 1;i <= n;i++) {
vx[i] = qs[max(x, i) - 1] - qs[min(x, i) - 1];
vy[i] = qs[max(y, i) - 1] - qs[min(y, i) - 1];
qsx[i] = qsx[i - 1] + vx[i];
qsy[i] = qsy[i - 1] + vy[i];
qsmx[i] = qsmx[i - 1] + max(vx[i], vy[i]);
}
int mx = 0;
for (int l1 = 1;l1 <= x;l1++) {
for (int r1 = x;r1 <= n;r1++) {
for (int l2 = 1;l2 <= y;l2++) {
for (int r2 = y;r2 <= n;r2++) {
ll val = 0;
if (l1 <= l2 && r2 <= r1) {
val += qsx[l2 - 1] - qsx[l1 - 1];
val += qsx[r1] - qsx[r2];
val += qsmx[r2] - qsmx[l2 - 1];
}
else if (l2 <= l1 && r1 <= r2) {
val += qsy[l1 - 1] - qsy[l2 - 1];
val += qsy[r2] - qsy[r1];
val += qsmx[r1] - qsmx[l1 - 1];
}
else if (r1 < l2) {
val += qsx[r1] - qsx[l1 - 1];
val += qsy[r2] - qsy[l2 - 1];
}
else {
val += qsx[l2 - 1] - qsx[l1 - 1];
val += qsy[r2] - qsy[r1];
val += qsmx[r1] - qsmx[l2 - 1];
}
if (val <= K) mx = max(mx, r1 - l1 + 1 + r2 - l2 + 1);
}
}
}
}
return mx;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 1st token, expected: '6', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
36 ms |
10068 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 1st token, expected: '30', found: '35' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 1st token, expected: '30', found: '35' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 1st token, expected: '30', found: '35' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 1st token, expected: '6', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 1st token, expected: '6', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 1st token, expected: '6', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 1st token, expected: '6', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 1st token, expected: '6', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |