#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];
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){
rep(j,0,N){
rep(k,0,N){
rep(l,0,N){
if(j<X || i>X || k>Y || l<Y) continue;
ll sum=0;
rep(m,0,N){
if(i<=m && m<=j && k<=m && m<=l) sum+=dis[m];
else if(i<=m && m<=j) sum+=disx[m];
else if(k<=m && m<=l) sum+=disy[m];
}
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 |
42 ms |
5100 KB |
1st lines differ - on the 1st token, expected: '451', found: '200000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '3', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '3', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '3', 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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |