#include <bits/stdc++.h>
#define rep(a,b,c) for(int a=b; a<c; a++)
#define repr(a,b,c) for(int a=b-1; a>c-1; a--)
#define repa(a,b) for(auto a:b)
#define ll long long
#define pll pair<ll, ll>
#define pb push_back
#define fi first
#define se second
using namespace std;
int max_score(int N, int X, int Y, ll K, vector<int> U, vector<int> V, vector<int> W){
if(N>50) return N;
ll nxt[N]{}, prv[N]{};
rep(i,0,N-1) nxt[i]=W[i], prv[i+1]=W[i];
int ans=0;
ll dis[N], disx[N], disy[N], p[N][3];
disx[X]=0;
disy[X]=0;
rep(i,X+1,N) disx[i]=disx[i-1]+nxt[i-1];
repr(i,X,0) disx[i]=disx[i+1]+prv[i+1];
rep(i,Y+1,N) disy[i]=disy[i-1]+nxt[i-1];
repr(i,Y,0) disy[i]=disy[i+1]+prv[i+1];
rep(i,0,N) dis[i]=max(disx[i],disy[i]);
rep(i,0,N){
p[i][0]=dis[i];
p[i][1]=disx[i];
p[i][2]=disy[i];
if(i){
p[i][0]+=p[i-1][0];
p[i][1]+=p[i-1][1];
p[i][2]+=p[i-1][2];
}
}
rep(i,0,N){
rep(j,i,N){
rep(k,i,N){
rep(l,j,N){
if(j<X || i>X || k>Y || l<Y) continue;
ll sum=0;
sum+=p[j][1]-p[i][1]+disx[i];
sum+=p[l][2]-p[k][2]+disy[k];
if(k<=j){
sum+=p[j][0]-p[k][0]+dis[k];
sum-=(p[j][1]-p[k][1]+disx[k]);
sum-=(p[j][2]-p[k][2]+disy[k]);
}
if(K>=sum) ans=max(ans,j+1-i+l+1-k);
}
}
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
44 ms |
4948 KB |
1st lines differ - on the 1st token, expected: '451', found: '200000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 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 |
2 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Incorrect |
2 ms |
348 KB |
1st lines differ - on the 1st token, expected: '74', found: '0' |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 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 |
2 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Incorrect |
2 ms |
348 KB |
1st lines differ - on the 1st token, expected: '74', found: '0' |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 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 |
2 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Incorrect |
2 ms |
348 KB |
1st lines differ - on the 1st token, expected: '74', found: '0' |
9 |
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 |
- |