# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
897271 | ErJ | 봉쇄 시간 (IOI23_closing) | C++17 | 1068 ms | 17992 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<pair<ll, ll>>
#define pp pair<ll, ll>
#define qi queue<ll>
#define qp queue<pp>
#define pqi priority_queue<ll>
#define pqp priority_queue<pp>
#define mi map<ll, ll>
#define mpi map<pp, ll>
#define mip map<ll, pp>
#define mpp map<pp, pp>
#define mb map<ll, bool>
#define si set<ll>
#define sp set<pp>
#define mod 1000000007
#define rep(a, b) for(int a = 0; a < (b); a++)
#define inf 10000000000
int max_score(int N, int X, int Y, ll K, vector<int> U, vector<int> V, vector<int> W) {
vector<ll> distX(N);
vector<ll> distY(N);
vector<ll> distXY(N);
vector<ll> distXY2(N);
distX[X] = 0;
distX[Y] = 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];
}
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];
}
for (int i = 0; i < N; i++) {
distXY[i] = max(distX[i], distY[i]);
distXY2[i] = min(distX[i], distY[i]);
}
vi prefX(N + 1);
vi prefY(N + 1);
vi prefXY(N + 1);
prefX[0] = 0;
prefY[0] = 0;
prefXY[0] = 0;
for (int i = 1; i < prefX.size(); i++) {
prefX[i] = prefX[i - 1] + distX[i - 1];
prefY[i] = prefY[i - 1] + distY[i - 1];
prefXY[i] = prefXY[i - 1] + distXY[i - 1];
}
ll ans = 0;
ans = 0;
//int ans = 0;
for (int i = 0; i <= X; i++) {
for (int j = X; j < N; j++) {
ll cena = prefX[j + 1] - prefX[i];
ll ans2 = 1;
ans2 += j - i + 1;
ll K2 = K - cena;
if (K2 < 0) continue;
ll l = Y, r = Y;
while (K2 > 0) {
ll left = inf;
if (l > 0) {
if (l - 1 <= j && l - 1 >= i) {
left = distXY[l - 1] - distX[l - 1];
}
else {
left = distY[l - 1];
}
}
ll right = inf;
if (r < N - 1) {
if (r + 1 <= j && r + 1 >= i) {
right = distXY[r + 1] - distX[r + 1];
}
else {
right = distY[r + 1];
}
}
//cout << K2 << " " << left << " " << right << endl;
if (K2 - min(left, right) < 0) break;
if (left < right && K2 - left >= 0) {
K2 -= left;
l--;
ans2++;
}
else if (K2 - right >= 0) {
K2 -= right;
r++;
ans2++;
}
}
ans = max(ans, ans2);
//cout << "AAAAA" << ans2 << " " << i << " " << j << endl;
}
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |