| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 12670 | kipa00 | 격자 보존하기 (GA9_preserve) | C++98 | 32 ms | 2372 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdio>
#include <queue>
using namespace std;
priority_queue<int, vector<int>, less<int> > put;
int horse[100000];
int main() {
int start, end, n, k, d;
int i;
scanf("%d %d %d", &n, &k, &d);
int last = -1;
for (i=0; i<k; ++i) {
int now;
scanf("%d", &now);
if (last < 0) {
last = now;
start = now - 1;
} else {
put.push(now - last - 1);
last = now;
}
}
end = n - last;
if (d == 1) printf("%d\n", (start > end) ? start : end);
else if (d == 2) printf("%d\n", (start + end > put.top()) ? (start + end) : put.top());
else {
int nd = d - 2;
int now = 0, max = -1;
for (i=0; i<nd/2; ++i) {
now += put.top();
put.pop();
}
nd %= 2;
nd += 2;
if (nd == 3) {
max = put.top() + start;
if (max < put.top() + end) {
max = put.top() + end;
}
if (max < start + end) {
max = start + end;
}
} else if (nd == 2) {
max = start + end;
if (max < put.top()) {
max = put.top();
}
}
printf("%d\n", now + max);
}
return 0;
}| # | 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... | ||||
