# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
1049752 |
2024-08-09T04:44:27 Z |
아침연습다풀고 hamburg 풀면 복붙날먹치팅할거임(#11102) |
함박 스테이크 (JOI20_hamburg) |
C++17 |
|
3000 ms |
46432 KB |
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pi = array<lint, 2>;
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define cr(v, n) (v).clear(), (v).resize(n);
const int MAXN = 1000005;
struct rect {
int sx, sy, ex, ey;
};
vector<pi> trace;
vector<rect> chop(vector<rect> a, pi p) {
vector<rect> z;
for (auto &r : a) {
if (r.sx <= p[0] && p[0] <= r.ex && r.sy <= p[1] && p[1] <= r.ey)
continue;
z.push_back(r);
}
return z;
}
void backtrack(vector<rect> a, int k, int p) {
if (sz(a) == 0) {
for (int i = 0; i < p; i++) {
cout << trace[i % sz(trace)][0] << " " << trace[i % sz(trace)][1] << "\n";
}
exit(0);
}
if (k == 0)
return;
int xmin = 2e9, ymin = 2e9, xmax = -2e9, ymax = -2e9;
for (auto &x : a) {
xmin = min(xmin, x.ex);
ymin = min(ymin, x.ey);
xmax = max(xmax, x.sx);
ymax = max(ymax, x.sy);
}
vector<pi> cp = {pi{xmax, ymax}, pi{xmax, ymin}, pi{xmin, ymax}, pi{xmin, ymin}};
for (auto &v : cp) {
trace.push_back(v);
backtrack(chop(a, v), k - 1, p);
trace.pop_back();
}
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, k;
cin >> n >> k;
vector<rect> a(n);
int exmin = 1e9;
for (auto &v : a) {
cin >> v.sx >> v.sy >> v.ex >> v.ey;
exmin = min(exmin, v.ex);
}
backtrack(a, k, k);
for (auto &v : a) {
trace.push_back({exmin, v.ey});
backtrack(chop(a, trace[0]), k - 1, k);
trace.pop_back();
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
604 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
1 ms |
604 KB |
Output is correct |
8 |
Correct |
1 ms |
604 KB |
Output is correct |
9 |
Correct |
1 ms |
604 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
600 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
604 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
604 KB |
Output is correct |
8 |
Correct |
3 ms |
760 KB |
Output is correct |
9 |
Correct |
1 ms |
604 KB |
Output is correct |
10 |
Correct |
2 ms |
604 KB |
Output is correct |
11 |
Correct |
2 ms |
604 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
13 |
Correct |
1 ms |
620 KB |
Output is correct |
14 |
Correct |
186 ms |
760 KB |
Output is correct |
15 |
Correct |
1 ms |
600 KB |
Output is correct |
16 |
Correct |
1 ms |
604 KB |
Output is correct |
17 |
Correct |
770 ms |
840 KB |
Output is correct |
18 |
Correct |
1 ms |
604 KB |
Output is correct |
19 |
Correct |
1 ms |
860 KB |
Output is correct |
20 |
Correct |
917 ms |
860 KB |
Output is correct |
21 |
Correct |
1 ms |
604 KB |
Output is correct |
22 |
Correct |
1 ms |
848 KB |
Output is correct |
23 |
Correct |
62 ms |
852 KB |
Output is correct |
24 |
Correct |
2 ms |
860 KB |
Output is correct |
25 |
Correct |
2 ms |
840 KB |
Output is correct |
26 |
Correct |
3 ms |
836 KB |
Output is correct |
27 |
Correct |
2 ms |
848 KB |
Output is correct |
28 |
Correct |
2 ms |
836 KB |
Output is correct |
29 |
Correct |
2 ms |
836 KB |
Output is correct |
30 |
Correct |
2 ms |
836 KB |
Output is correct |
31 |
Correct |
514 ms |
856 KB |
Output is correct |
32 |
Correct |
7 ms |
604 KB |
Output is correct |
33 |
Correct |
785 ms |
844 KB |
Output is correct |
34 |
Correct |
97 ms |
796 KB |
Output is correct |
35 |
Correct |
81 ms |
860 KB |
Output is correct |
36 |
Correct |
105 ms |
820 KB |
Output is correct |
37 |
Correct |
1824 ms |
880 KB |
Output is correct |
38 |
Correct |
896 ms |
872 KB |
Output is correct |
39 |
Correct |
352 ms |
1060 KB |
Output is correct |
40 |
Correct |
65 ms |
836 KB |
Output is correct |
41 |
Correct |
92 ms |
852 KB |
Output is correct |
42 |
Correct |
599 ms |
896 KB |
Output is correct |
43 |
Correct |
34 ms |
836 KB |
Output is correct |
44 |
Correct |
62 ms |
840 KB |
Output is correct |
45 |
Correct |
2 ms |
856 KB |
Output is correct |
46 |
Correct |
656 ms |
848 KB |
Output is correct |
47 |
Correct |
437 ms |
996 KB |
Output is correct |
48 |
Correct |
13 ms |
876 KB |
Output is correct |
49 |
Correct |
313 ms |
860 KB |
Output is correct |
50 |
Correct |
941 ms |
824 KB |
Output is correct |
51 |
Correct |
489 ms |
1008 KB |
Output is correct |
52 |
Correct |
4 ms |
820 KB |
Output is correct |
53 |
Correct |
12 ms |
836 KB |
Output is correct |
54 |
Correct |
1416 ms |
1064 KB |
Output is correct |
55 |
Correct |
350 ms |
604 KB |
Output is correct |
56 |
Correct |
339 ms |
604 KB |
Output is correct |
57 |
Correct |
333 ms |
604 KB |
Output is correct |
58 |
Correct |
725 ms |
600 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
47 ms |
9740 KB |
Output is correct |
6 |
Correct |
43 ms |
9732 KB |
Output is correct |
7 |
Correct |
52 ms |
9736 KB |
Output is correct |
8 |
Correct |
52 ms |
9812 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
604 KB |
Output is correct |
5 |
Correct |
47 ms |
13004 KB |
Output is correct |
6 |
Correct |
54 ms |
16336 KB |
Output is correct |
7 |
Correct |
48 ms |
12664 KB |
Output is correct |
8 |
Correct |
58 ms |
22472 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
604 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
1 ms |
604 KB |
Output is correct |
8 |
Correct |
1 ms |
604 KB |
Output is correct |
9 |
Correct |
1 ms |
604 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
600 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
13 |
Correct |
48 ms |
14704 KB |
Output is correct |
14 |
Correct |
46 ms |
14536 KB |
Output is correct |
15 |
Correct |
47 ms |
15304 KB |
Output is correct |
16 |
Correct |
45 ms |
12748 KB |
Output is correct |
17 |
Correct |
47 ms |
14028 KB |
Output is correct |
18 |
Correct |
49 ms |
11980 KB |
Output is correct |
19 |
Correct |
50 ms |
14536 KB |
Output is correct |
20 |
Correct |
151 ms |
29344 KB |
Output is correct |
21 |
Correct |
51 ms |
18892 KB |
Output is correct |
22 |
Correct |
82 ms |
29184 KB |
Output is correct |
23 |
Correct |
104 ms |
26440 KB |
Output is correct |
24 |
Correct |
87 ms |
28892 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
604 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
604 KB |
Output is correct |
8 |
Correct |
3 ms |
760 KB |
Output is correct |
9 |
Correct |
1 ms |
604 KB |
Output is correct |
10 |
Correct |
2 ms |
604 KB |
Output is correct |
11 |
Correct |
2 ms |
604 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
13 |
Correct |
1 ms |
620 KB |
Output is correct |
14 |
Correct |
186 ms |
760 KB |
Output is correct |
15 |
Correct |
1 ms |
600 KB |
Output is correct |
16 |
Correct |
1 ms |
604 KB |
Output is correct |
17 |
Correct |
770 ms |
840 KB |
Output is correct |
18 |
Correct |
1 ms |
604 KB |
Output is correct |
19 |
Correct |
1 ms |
860 KB |
Output is correct |
20 |
Correct |
917 ms |
860 KB |
Output is correct |
21 |
Correct |
1 ms |
604 KB |
Output is correct |
22 |
Correct |
1 ms |
848 KB |
Output is correct |
23 |
Correct |
62 ms |
852 KB |
Output is correct |
24 |
Correct |
2 ms |
860 KB |
Output is correct |
25 |
Correct |
2 ms |
840 KB |
Output is correct |
26 |
Correct |
3 ms |
836 KB |
Output is correct |
27 |
Correct |
2 ms |
848 KB |
Output is correct |
28 |
Correct |
2 ms |
836 KB |
Output is correct |
29 |
Correct |
2 ms |
836 KB |
Output is correct |
30 |
Correct |
2 ms |
836 KB |
Output is correct |
31 |
Correct |
514 ms |
856 KB |
Output is correct |
32 |
Correct |
7 ms |
604 KB |
Output is correct |
33 |
Correct |
785 ms |
844 KB |
Output is correct |
34 |
Correct |
97 ms |
796 KB |
Output is correct |
35 |
Correct |
81 ms |
860 KB |
Output is correct |
36 |
Correct |
105 ms |
820 KB |
Output is correct |
37 |
Correct |
1824 ms |
880 KB |
Output is correct |
38 |
Correct |
896 ms |
872 KB |
Output is correct |
39 |
Correct |
352 ms |
1060 KB |
Output is correct |
40 |
Correct |
65 ms |
836 KB |
Output is correct |
41 |
Correct |
92 ms |
852 KB |
Output is correct |
42 |
Correct |
599 ms |
896 KB |
Output is correct |
43 |
Correct |
34 ms |
836 KB |
Output is correct |
44 |
Correct |
62 ms |
840 KB |
Output is correct |
45 |
Correct |
2 ms |
856 KB |
Output is correct |
46 |
Correct |
656 ms |
848 KB |
Output is correct |
47 |
Correct |
437 ms |
996 KB |
Output is correct |
48 |
Correct |
13 ms |
876 KB |
Output is correct |
49 |
Correct |
313 ms |
860 KB |
Output is correct |
50 |
Correct |
941 ms |
824 KB |
Output is correct |
51 |
Correct |
489 ms |
1008 KB |
Output is correct |
52 |
Correct |
4 ms |
820 KB |
Output is correct |
53 |
Correct |
12 ms |
836 KB |
Output is correct |
54 |
Correct |
1416 ms |
1064 KB |
Output is correct |
55 |
Correct |
350 ms |
604 KB |
Output is correct |
56 |
Correct |
339 ms |
604 KB |
Output is correct |
57 |
Correct |
333 ms |
604 KB |
Output is correct |
58 |
Correct |
725 ms |
600 KB |
Output is correct |
59 |
Correct |
52 ms |
23748 KB |
Output is correct |
60 |
Correct |
56 ms |
24424 KB |
Output is correct |
61 |
Correct |
52 ms |
23748 KB |
Output is correct |
62 |
Correct |
50 ms |
23264 KB |
Output is correct |
63 |
Correct |
50 ms |
22732 KB |
Output is correct |
64 |
Correct |
48 ms |
18916 KB |
Output is correct |
65 |
Correct |
52 ms |
26976 KB |
Output is correct |
66 |
Correct |
312 ms |
37168 KB |
Output is correct |
67 |
Correct |
106 ms |
34476 KB |
Output is correct |
68 |
Correct |
417 ms |
45044 KB |
Output is correct |
69 |
Correct |
555 ms |
43488 KB |
Output is correct |
70 |
Correct |
354 ms |
43660 KB |
Output is correct |
71 |
Correct |
55 ms |
28128 KB |
Output is correct |
72 |
Execution timed out |
3078 ms |
46432 KB |
Time limit exceeded |
73 |
Halted |
0 ms |
0 KB |
- |