답안 #980220

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
980220 2024-05-12T01:20:27 Z vjudge1 봉쇄 시간 (IOI23_closing) C++17
0 / 100
46 ms 5108 KB
#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,i,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);
					//cout<<i<<" "<<j<<" "<<k<<" "<<l<<" "<<X<<" "<<Y<<" "<<sum<<" "<<j+1-i+l+1-k<<endl;
				}
			}
		}
	}
	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 46 ms 5108 KB 1st lines differ - on the 1st token, expected: '451', found: '200000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 1 ms 604 KB 1st lines differ - on the 1st token, expected: '30', found: '34'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 1 ms 604 KB 1st lines differ - on the 1st token, expected: '30', found: '34'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 1 ms 604 KB 1st lines differ - on the 1st token, expected: '30', found: '34'
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 -