| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 856473 | nnin | Rice Hub (IOI11_ricehub) | C++14 | 1096 ms | 636 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "ricehub.h"
#include<bits/stdc++.h>
#define ll long long
#define pii pair<ll,int>
using namespace std;
int besthub(int n, int m, int x[], long long b) {
int ans = 0;
int posi = x[0];
ll cost = 0;
int l = 0;
int r = 0;
for(int i=0;i<n;i++) {
if(i>0) cost += (x[i]-x[i-1])*(i-l-r+i-1);
while(r<i) {
cost += x[++r]-x[i];
}
while(cost>b) {
if(x[r]-x[i] > x[i]-x[l]) {
cost -= x[r--]-x[i];
} else {
cost -= x[i]-x[l++];
}
}
while(true) {
if(r<n-1 && x[r+1]-x[i] <= x[i]-x[l]) {
cost += x[++r]-x[i];
cost -= x[i]-x[l++];
} else if(l>0 && x[i]-x[l-1] <= x[r]-x[i]) {
cost += x[i]-x[--l];
cost -= x[r--]-x[i];
} else if(r<n-1 && cost+x[r+1]-x[i] <= b) {
cost += x[++r]-x[i];
} else if(l>0 && cost+x[i]-x[l-1] <= b) {
cost += x[i]-x[--l];
} else {
break;
}
}
ans = max(ans, r-l+1);
}
return ans;
}
/*
5 20 6
1
2
10
12
14
3
*/
컴파일 시 표준 에러 (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... | ||||
