답안 #980195

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
980195 2024-05-12T00:56:00 Z vjudge1 봉쇄 시간 (IOI23_closing) C++17
0 / 100
1000 ms 17624 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){
	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){
		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;
					if(i) sum+=p[min(j,k-1)][1]-p[i-1][1];
					sum+=p[l][2]-p[max(j,k-1)][2];
					if(k<=j) sum+=p[j][0]-p[k-1][0];
					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: '14'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1046 ms 17624 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '4'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '4'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '4'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '14'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '14'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '14'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '14'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '14'
2 Halted 0 ms 0 KB -