# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1078761 | PoPularPlusPlus | 봉쇄 시간 (IOI23_closing) | C++17 | 1061 ms | 5860 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "closing.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define vf first
#define vs second
int max_score(int n, int x, int y, ll k,vector<int> u, vector<int> v, vector<int> w){
ll cur = 0;
int ans = 0;
int cur_w[n];
for(int i = x; i >= 0; i--){
for(int j = y; j < n; j++){
memset(cur_w,0,sizeof cur_w);
ll rem = k;
ll cur = 0;
for(int tp = x; tp >= i; tp--){
rem -= cur;
cur_w[tp] = cur;
if(tp > 0){
cur += w[tp-1];
}
}
cur = 0;
for(int tp = y; tp <= j; tp++){
rem -= cur;
cur_w[tp] = cur;
cur += w[tp];
}
if(rem >= 0){
int res = (x - i) + (j - y) + 2;
// cout << res << ' ';
int left = x + 1 , right = y - 1;
ll cur_l = w[x] , cur_r = w[y-1];
while(rem >= 0 && left < n && right >= 0){
if(right < 0 || (left < n && cur_l - cur_w[left] < cur_r - cur_w[right])){
if(rem - (max(0LL,cur_l - cur_w[left])) >= 0){
rem -= (max(0LL,cur_l - cur_w[left]));
cur_w[left] += (max(0LL,cur_l - cur_w[left]));
res++;
left++;
cur_l += w[left-1];
}
else break;
}
else {
if(rem - max(0LL, cur_r - cur_w[right]) >= 0){
rem -= max(0LL, cur_r - cur_w[right]);
cur_w[right] += max(0LL, cur_r - cur_w[right]);
res++;
right--;
cur_r += w[right];
}
else break;
}
}
// cout << i << ' ' << j << ' ' << res << ' ' << rem << ' ' << left << ' ' << right << '\n';
// cout << i << ' ' << j << ' ' << res << ' ' << left << ' ' << right << "\n";
ans = max(ans , res);
}
}
}
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... |