# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
218220 | MiricaMatei | 함박 스테이크 (JOI20_hamburg) | C++14 | 3098 ms | 3576 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
const int MAXK = 4;
const int INF = 1000000000;
struct Drept {
int x1, y1, x2, y2;
} v[MAXN], sol[MAXK + 5];
pair<bool, Drept> inters(Drept a, Drept b) {
Drept c;
c.x1 = max(a.x1, b.x1);
c.y1 = max(a.y1, b.y1);
c.x2 = min(a.x2, b.x2);
c.y2 = min(a.y2, b.y2);
if (c.x1 <= c.x2 && c.y1 <= c.y2)
return {1, c};
return {0, c};
}
int main() {
//freopen("date.in", "r", stdin);
//freopen("date.out", "w", stdout);
srand(time(0));
int n, k;
scanf("%d%d", &n, &k);
for (int i = 1; i <= n; ++i)
scanf("%d%d%d%d", &v[i].x1, &v[i].y1, &v[i].x2, &v[i].y2);
while (1) {
for (int i = 1; i <= k; ++i)
sol[i] = {1, 1, INF, INF};
random_shuffle(v + 1, v + n + 1);
bool gas = 1;
for (int i = 1; i <= n; ++i) {
bool ok = 0;
for (int j = 1; j <= k; ++j) {
pair<bool, Drept>aux = inters(sol[j], v[i]);
if (aux.first) {
sol[j] = aux.second;
ok = 1;
break;
}
}
if (!ok) {
gas = 0;
break;
}
}
if (gas) {
for (int i = 1; i <= k; ++i)
printf("%d %d\n", sol[i].x1, sol[i].y1);
return 0;
}
}
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... |
# | 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... |