Submission #652816

# Submission time Handle Problem Language Result Execution time Memory
652816 2022-10-24T15:53:57 Z XCAC197 Hamburg Steak (JOI20_hamburg) C++14
21 / 100
3000 ms 15908 KB
//This code is meant to test lunchbox's code against the stronger test data. All credit is due to lunchbox (Dong Liu)
/*
 author: lunchbox
 problem link: https://c...content-available-to-author-only...s.com/group/uodset6U2h/contest/405473/problem/C
*/
#include <bits/stdc++.h>
using namespace std;

const int N = 2e5, MX = 1e9;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

struct rect {
 long long l, d, u, r, i;

 rect operator+(const rect& o) {
  return {max(l, o.l), max(d, o.d), min(u, o.u), min(r, o.r), -1};
 }
 bool empty() const {
  return l > r || d > u;
 }
 long long area() const {
  assert(!empty());
  return 1LL * (r - l + 1) * (u - d + 1);
 }
} a[N];

int main() {
 ios::sync_with_stdio(0), cin.tie(0);
 int n, k; cin >> n >> k;
 for (int i = 0; i < n; i++) cin >> a[i].l >> a[i].d >> a[i].r >> a[i].u, a[i].i = i;
 if (k >= n) {
  for (int i = 0; i < n; i++) cout << a[i].l << ' ' << a[i].d << '\n';
  for (int i = n; i < k; i++) cout << 1 << ' ' << 1 << '\n';
  return 0;
 }
 while (1) {
  static rect b[4];
  for (int i = 0; i < n; i++) swap(a[i], a[rng() % (i + 1)]);
  for (int i = 0; i < k; i++) b[i] = a[i];
  bool g = 1;
  for (int i = k; i < n; i++) {
   int u = -1;
   for (int j = 0; j < k; j++)
    if (!(b[j] + a[i]).empty() && (u == -1 || (__int128) (b[j] + a[i]).area() * b[u].area() > (__int128) (b[u] + a[i]).area() * b[j].area()))
     u = j;
   if (u == -1) {
    g = 0;
    break;
   } else
    b[u] = b[u] + a[i];
  }
  if (g) {
   for (int i = 0; i < k; i++) cout << b[i].l << ' ' << b[i].d << '\n';
   break;
  }
 }
 return 0;
}//
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 2 ms 468 KB Output is correct
3 Correct 2 ms 476 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 484 KB Output is correct
2 Correct 2 ms 468 KB Output is correct
3 Correct 2 ms 476 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 480 KB Output is correct
2 Correct 2 ms 468 KB Output is correct
3 Correct 2 ms 468 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
5 Correct 2 ms 480 KB Output is correct
6 Correct 2 ms 468 KB Output is correct
7 Correct 2 ms 468 KB Output is correct
8 Correct 2 ms 476 KB Output is correct
9 Correct 2 ms 424 KB Output is correct
10 Correct 2 ms 476 KB Output is correct
11 Correct 2 ms 476 KB Output is correct
12 Correct 2 ms 476 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 468 KB Output is correct
2 Correct 3 ms 596 KB Output is correct
3 Correct 3 ms 468 KB Output is correct
4 Correct 2 ms 480 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 472 KB Output is correct
7 Correct 2 ms 424 KB Output is correct
8 Correct 7 ms 468 KB Output is correct
9 Correct 4 ms 480 KB Output is correct
10 Correct 2 ms 476 KB Output is correct
11 Correct 5 ms 468 KB Output is correct
12 Correct 3 ms 468 KB Output is correct
13 Correct 2 ms 468 KB Output is correct
14 Correct 3 ms 456 KB Output is correct
15 Correct 2 ms 468 KB Output is correct
16 Correct 4 ms 468 KB Output is correct
17 Correct 3 ms 468 KB Output is correct
18 Correct 5 ms 468 KB Output is correct
19 Correct 4 ms 468 KB Output is correct
20 Correct 4 ms 476 KB Output is correct
21 Correct 4 ms 476 KB Output is correct
22 Correct 2 ms 468 KB Output is correct
23 Correct 2 ms 468 KB Output is correct
24 Correct 3 ms 468 KB Output is correct
25 Correct 2 ms 420 KB Output is correct
26 Correct 4 ms 468 KB Output is correct
27 Correct 3 ms 424 KB Output is correct
28 Correct 7 ms 468 KB Output is correct
29 Correct 3 ms 472 KB Output is correct
30 Correct 4 ms 472 KB Output is correct
31 Correct 6 ms 492 KB Output is correct
32 Correct 3 ms 472 KB Output is correct
33 Correct 3 ms 468 KB Output is correct
34 Correct 2 ms 472 KB Output is correct
35 Correct 4 ms 468 KB Output is correct
36 Correct 2 ms 468 KB Output is correct
37 Correct 2 ms 468 KB Output is correct
38 Correct 6 ms 468 KB Output is correct
39 Correct 3 ms 468 KB Output is correct
40 Correct 2 ms 468 KB Output is correct
41 Correct 2 ms 468 KB Output is correct
42 Correct 3 ms 468 KB Output is correct
43 Correct 2 ms 468 KB Output is correct
44 Correct 2 ms 456 KB Output is correct
45 Correct 2 ms 468 KB Output is correct
46 Correct 5 ms 488 KB Output is correct
47 Correct 11 ms 416 KB Output is correct
48 Correct 4 ms 468 KB Output is correct
49 Correct 8 ms 472 KB Output is correct
50 Correct 2 ms 480 KB Output is correct
51 Correct 13 ms 496 KB Output is correct
52 Correct 3 ms 480 KB Output is correct
53 Correct 2 ms 468 KB Output is correct
54 Correct 4 ms 468 KB Output is correct
55 Correct 2 ms 468 KB Output is correct
56 Correct 3 ms 424 KB Output is correct
57 Correct 2 ms 476 KB Output is correct
58 Correct 2 ms 416 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 2 ms 468 KB Output is correct
3 Correct 2 ms 476 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
5 Correct 88 ms 15816 KB Output is correct
6 Correct 88 ms 15796 KB Output is correct
7 Correct 92 ms 15840 KB Output is correct
8 Correct 87 ms 15824 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 484 KB Output is correct
2 Correct 2 ms 468 KB Output is correct
3 Correct 2 ms 476 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
5 Correct 90 ms 15820 KB Output is correct
6 Correct 108 ms 15804 KB Output is correct
7 Correct 97 ms 15824 KB Output is correct
8 Correct 94 ms 15860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 480 KB Output is correct
2 Correct 2 ms 468 KB Output is correct
3 Correct 2 ms 468 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
5 Correct 2 ms 480 KB Output is correct
6 Correct 2 ms 468 KB Output is correct
7 Correct 2 ms 468 KB Output is correct
8 Correct 2 ms 476 KB Output is correct
9 Correct 2 ms 424 KB Output is correct
10 Correct 2 ms 476 KB Output is correct
11 Correct 2 ms 476 KB Output is correct
12 Correct 2 ms 476 KB Output is correct
13 Correct 151 ms 15788 KB Output is correct
14 Correct 113 ms 15788 KB Output is correct
15 Correct 91 ms 15816 KB Output is correct
16 Correct 94 ms 15804 KB Output is correct
17 Correct 96 ms 15784 KB Output is correct
18 Correct 137 ms 15908 KB Output is correct
19 Correct 90 ms 15848 KB Output is correct
20 Correct 220 ms 15820 KB Output is correct
21 Correct 116 ms 15808 KB Output is correct
22 Correct 97 ms 15796 KB Output is correct
23 Correct 92 ms 15820 KB Output is correct
24 Correct 95 ms 15820 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 468 KB Output is correct
2 Correct 3 ms 596 KB Output is correct
3 Correct 3 ms 468 KB Output is correct
4 Correct 2 ms 480 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 472 KB Output is correct
7 Correct 2 ms 424 KB Output is correct
8 Correct 7 ms 468 KB Output is correct
9 Correct 4 ms 480 KB Output is correct
10 Correct 2 ms 476 KB Output is correct
11 Correct 5 ms 468 KB Output is correct
12 Correct 3 ms 468 KB Output is correct
13 Correct 2 ms 468 KB Output is correct
14 Correct 3 ms 456 KB Output is correct
15 Correct 2 ms 468 KB Output is correct
16 Correct 4 ms 468 KB Output is correct
17 Correct 3 ms 468 KB Output is correct
18 Correct 5 ms 468 KB Output is correct
19 Correct 4 ms 468 KB Output is correct
20 Correct 4 ms 476 KB Output is correct
21 Correct 4 ms 476 KB Output is correct
22 Correct 2 ms 468 KB Output is correct
23 Correct 2 ms 468 KB Output is correct
24 Correct 3 ms 468 KB Output is correct
25 Correct 2 ms 420 KB Output is correct
26 Correct 4 ms 468 KB Output is correct
27 Correct 3 ms 424 KB Output is correct
28 Correct 7 ms 468 KB Output is correct
29 Correct 3 ms 472 KB Output is correct
30 Correct 4 ms 472 KB Output is correct
31 Correct 6 ms 492 KB Output is correct
32 Correct 3 ms 472 KB Output is correct
33 Correct 3 ms 468 KB Output is correct
34 Correct 2 ms 472 KB Output is correct
35 Correct 4 ms 468 KB Output is correct
36 Correct 2 ms 468 KB Output is correct
37 Correct 2 ms 468 KB Output is correct
38 Correct 6 ms 468 KB Output is correct
39 Correct 3 ms 468 KB Output is correct
40 Correct 2 ms 468 KB Output is correct
41 Correct 2 ms 468 KB Output is correct
42 Correct 3 ms 468 KB Output is correct
43 Correct 2 ms 468 KB Output is correct
44 Correct 2 ms 456 KB Output is correct
45 Correct 2 ms 468 KB Output is correct
46 Correct 5 ms 488 KB Output is correct
47 Correct 11 ms 416 KB Output is correct
48 Correct 4 ms 468 KB Output is correct
49 Correct 8 ms 472 KB Output is correct
50 Correct 2 ms 480 KB Output is correct
51 Correct 13 ms 496 KB Output is correct
52 Correct 3 ms 480 KB Output is correct
53 Correct 2 ms 468 KB Output is correct
54 Correct 4 ms 468 KB Output is correct
55 Correct 2 ms 468 KB Output is correct
56 Correct 3 ms 424 KB Output is correct
57 Correct 2 ms 476 KB Output is correct
58 Correct 2 ms 416 KB Output is correct
59 Correct 145 ms 13256 KB Output is correct
60 Correct 109 ms 13240 KB Output is correct
61 Correct 142 ms 13208 KB Output is correct
62 Correct 120 ms 13264 KB Output is correct
63 Correct 99 ms 13264 KB Output is correct
64 Correct 112 ms 13284 KB Output is correct
65 Correct 352 ms 13384 KB Output is correct
66 Correct 240 ms 13352 KB Output is correct
67 Correct 130 ms 13484 KB Output is correct
68 Correct 323 ms 13516 KB Output is correct
69 Correct 114 ms 13524 KB Output is correct
70 Correct 183 ms 13488 KB Output is correct
71 Correct 135 ms 13388 KB Output is correct
72 Correct 298 ms 13508 KB Output is correct
73 Correct 314 ms 13560 KB Output is correct
74 Correct 385 ms 13396 KB Output is correct
75 Correct 211 ms 13408 KB Output is correct
76 Correct 383 ms 13612 KB Output is correct
77 Correct 351 ms 13416 KB Output is correct
78 Correct 211 ms 13204 KB Output is correct
79 Correct 124 ms 13244 KB Output is correct
80 Correct 126 ms 13228 KB Output is correct
81 Correct 214 ms 13400 KB Output is correct
82 Correct 163 ms 13332 KB Output is correct
83 Correct 165 ms 13148 KB Output is correct
84 Correct 290 ms 13136 KB Output is correct
85 Correct 276 ms 13300 KB Output is correct
86 Correct 318 ms 13248 KB Output is correct
87 Correct 122 ms 13256 KB Output is correct
88 Correct 96 ms 13232 KB Output is correct
89 Correct 129 ms 13024 KB Output is correct
90 Correct 279 ms 12932 KB Output is correct
91 Correct 91 ms 12924 KB Output is correct
92 Correct 600 ms 12768 KB Output is correct
93 Correct 127 ms 12628 KB Output is correct
94 Correct 287 ms 12736 KB Output is correct
95 Correct 235 ms 12776 KB Output is correct
96 Correct 368 ms 12740 KB Output is correct
97 Correct 448 ms 12736 KB Output is correct
98 Correct 220 ms 12620 KB Output is correct
99 Correct 118 ms 12492 KB Output is correct
100 Correct 146 ms 12552 KB Output is correct
101 Correct 326 ms 12756 KB Output is correct
102 Correct 133 ms 12696 KB Output is correct
103 Correct 228 ms 12460 KB Output is correct
104 Correct 339 ms 12352 KB Output is correct
105 Correct 580 ms 12380 KB Output is correct
106 Correct 204 ms 12372 KB Output is correct
107 Correct 367 ms 12328 KB Output is correct
108 Correct 216 ms 12236 KB Output is correct
109 Correct 225 ms 12240 KB Output is correct
110 Correct 439 ms 12412 KB Output is correct
111 Correct 439 ms 12352 KB Output is correct
112 Correct 147 ms 12352 KB Output is correct
113 Correct 154 ms 12492 KB Output is correct
114 Correct 93 ms 12236 KB Output is correct
115 Correct 160 ms 12364 KB Output is correct
116 Correct 99 ms 12296 KB Output is correct
117 Execution timed out 3098 ms 12096 KB Time limit exceeded
118 Halted 0 ms 0 KB -