| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 705295 | rainboy | Semiexpress (JOI17_semiexpress) | C11 | 1 ms | 300 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#define N 3000
long long min(long long a, long long b) { return a < b ? a : b; }
int xx[N + 1], n, k_, k, ans; long long a, b, c, t;
int solve(int d) {
int x, x_, i;
ans = 0, k = 0;
for (i = 0; i < n && xx[i] * a <= t; i++) {
x = min(xx[i] + (t - xx[i] * a) / c + 1, xx[i + 1]);
while (x < xx[i + 1] && xx[i] * a + (x - xx[i]) * b <= t) {
x_ = min(x + (t - xx[i] * a - (x - xx[i]) * b) / c + 1, xx[i + 1]);
if (x_ - x <= d)
break;
x = x_;
if (++k > k_)
return 0;
}
ans += x - xx[i];
}
return 1;
}
int main() {
int i, lower, upper;
scanf("%*d%d%d%lld%lld%lld%lld", &n, &k_, &c, &a, &b, &t), k_ -= n;
for (i = 0; i < n; i++)
scanf("%d", &xx[i]), xx[i]--;
xx[n] = xx[n - 1] + 1;
solve(0);
lower = -1, upper = xx[n - 1] + 1;
while (upper - lower > 1) {
int d = (lower + upper) / 2;
if (solve(d))
upper = d;
else
lower = d;
}
solve(upper);
ans += (k_ - k) * upper - 1;
printf("%d\n", ans);
return 0;
}
컴파일 시 표준 에러 (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... | ||||
