# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
897625 | ErJ | 봉쇄 시간 (IOI23_closing) | C++17 | 1120 ms | 1566568 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 rep2(a, b) for(int a = 1; a < (b); a++)
#define inf 1000000000000000000
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), distXY3(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]);
distXY3[i] = distXY2[i];
}
sort(distXY3.begin(), distXY3.end());
ll anslvl1 = 0;
ll sum = 0;
rep(i, distXY3.size()) {
sum += distXY3[i];
if (sum <= K) {
anslvl1++;
}
}
vvi dp(N + 1);
dp[0].resize(2*N + 1);
for (int i = 0; i < 2 * N + 1; i++) {
dp[0][i] = inf;
}
dp[0][0] = 0;
for (int i = 1; i < dp.size(); i++) {
dp[i].resize(2 * N + 1);
if (!(i - 1 >= X && i - 1 <= Y)) {
for (int j = 0; j < 2 * N + 1; j++) {
dp[i][j] = dp[i - 1][j];
}
}
else {
for (int j = 0; j < 2 * N + 1; j++) {
dp[i][j] = inf;
}
}
for (int j = 0; j < 2 * N + 1; j++) {
if (dp[i - 1][j] != inf) {
dp[i][j + 1] = min(dp[i][j + 1], dp[i - 1][j] + distXY2[i - 1]);
dp[i][j + 2] = min(dp[i][j + 2], dp[i - 1][j] + distXY[i - 1]);
}
}
}
ll ans = 0;
for (int i = 2 * N; i >= 0; i--) {
if (dp[N][i] <= K) {
ans = i;
break;
}
}
return max(ans, anslvl1);
}
컴파일 시 표준 에러 (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... |