답안 #957637

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
957637 2024-04-04T06:38:48 Z 42kangaroo 봉쇄 시간 (IOI23_closing) C++17
9 / 100
1000 ms 9936 KB
#include "closing.h"

#include <vector>

int max_score(int N, int X, int Y, long long K,
              std::vector<int> U, std::vector<int> V, std::vector<int> W) {
	using namespace std;
	if (X > Y) swap(X, Y);
	vector<int> distX(N), distY(N);
	distX[X] = 0;
	for (int i = X + 1; i < N; ++i) {
		distX[i] = distX[i - 1] + W[i - 1];
	}
	for (int i = X - 1; i >= 0; --i) {
		distX[i] = distX[i + 1] + W[i];
	}
	distY[Y] = 0;
	for (int i = Y + 1; i < N; ++i) {
		distY[i] = distY[i - 1] + W[i - 1];
	}
	for (int i = Y - 1; i >= 0; --i) {
		distY[i] = distY[i + 1] + W[i];
	}
	int ma = 0;
	for (int i = 0; i <= X; ++i) {
		int co = 0;
		for (int j = i; j < N; ++j) {
			co += distX[j];
			if (j >= X) {
				int act = j - i + 1;
				if (co > K) continue;
				else {
					int co2 = K - co;
					int lon = 0;
					int l = 0, r = Y;
					int cos = 0;
					for (int k = 0; k < Y; ++k) {
						if (i <= k && k <= j && distX[k] > distY[k]);
						else if (i <= k && k <= j) cos += distY[k] - distX[k];
						else cos += distY[k];
					}
					while (l < Y && r < N) {
						while (l < Y && r < N && cos > co2) {
							if (i <= l && l <= j && distX[l] > distY[l]);
							else if (i <= l && l <= j) cos -= distY[l] - distX[l];
							else cos -= distY[l];
							l++;
						}
						while (r < N && cos <= co2) {
							lon = max(lon, r - l + 1);
							r++;
							if (r == N) break;
							if (i <= r && r <= j && distX[r] > distY[r]);
							else if (i <= r && r <= j) cos += distY[r] - distX[r];
							else cos += distY[r];
						}
					}
					act += lon;
					ma = max(ma, act);
				}
			}
		}
	}
	return ma;
}
# 결과 실행 시간 메모리 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 Execution timed out 1048 ms 9936 KB Time limit exceeded
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 0 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 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 356 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 420 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 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 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 356 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 420 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '18', found: '198'
14 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 0 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 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 356 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 420 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '18', found: '198'
14 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 -