QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#477817 | #898. 二分图最大匹配 | NOI_AK_ME# | AC ✓ | 50ms | 13408kb | C++20 | 9.4kb | 2024-07-14 11:00:57 | 2024-07-14 11:00:57 |
Judging History
answer
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
std::vector<std::pair<int, int>> bipartite_matching(int n, const std::vector<std::pair<int, int>>& edg) {
std::vector<int> vec(n, -1);
std::vector<int> cnt(n + 1);
std::vector<int> gr(edg.size() * 2);
{
for (auto [u, v] : edg) {
cnt[u]++, cnt[v]++;
}
for (int i = 0, c = 0; i <= n; i++) {
c += cnt[i], cnt[i] = c;
}
for (int i = 0; i < edg.size(); i++) {
auto& [u, v] = edg.rbegin()[i];
gr[--cnt[u]] = v;
gr[--cnt[v]] = u;
}
}
struct Data {
int used, prev, root, depth;
};
std::vector<Data> data(n, Data{0, 0, 0, 0});
int used_mark = 0;
std::vector<int> deque(n);
int deque_beg_ptr = 0, deque_end_ptr = 0;
int prev_min_len = 0;
while (true) {
clock_t beg = clock();
int cur_min_len = n;
used_mark++;
deque_beg_ptr = deque_end_ptr = 0;
for (int i = 0; i < n; i++) {
if (vec[i] == -1) {
data[i] = {used_mark, -1, i, 0};
deque[deque_end_ptr++] = i;
}
}
int aug_cnt = 0;
while (deque_beg_ptr < deque_end_ptr) {
int v = deque[deque_beg_ptr++];
if (vec[data[v].root] != -1) {
continue;
}
bool aug_found = false;
for (int ti = cnt[v]; ti < cnt[v + 1]; ti++) {
int t = gr[ti];
if (data[t].used == used_mark && data[t].depth == 0 && vec[data[t].root] == -1) {
aug_cnt++;
vec[v] = t, vec[t] = v;
int len = 1;
for (int x : std::array<int, 2>{v, t}) {
for (; data[x].prev != -1; x = data[x].prev) {
if (data[x].depth == 1) {
vec[x] = data[x].prev, vec[data[x].prev] = x;
}
len++;
}
}
cur_min_len = std::min(cur_min_len, len);
aug_found = true;
break;
}
}
if (aug_found) {
continue;
}
for (int ti = cnt[v]; ti < cnt[v + 1]; ti++) {
int t = gr[ti];
if (data[t].used != used_mark) {
int t2 = vec[t];
data[t] = {used_mark, v, data[v].root, 1};
data[t2] = {used_mark, t, data[v].root, 0};
deque[deque_end_ptr++] = t2;
}
}
}
if (!aug_cnt) {
break;
}
std::cerr << aug_cnt << " " << cur_min_len << " ";
std::cerr << (clock() - beg) * 1.0 / CLOCKS_PER_SEC * 1000 << "ms ";
if (prev_min_len >= cur_min_len) {
std::cerr << " FUCK!!!";
}
std::cerr << "\n";
prev_min_len = cur_min_len;
}
std::vector<std::pair<int, int>> res;
for (int i = 0; i < n; i++) {
if (vec[i] > i) {
res.push_back({i, vec[i]});
}
}
return res;
}
using std::cin, std::cout;
// io from https://judge.yosupo.jp/submission/154408
namespace IO {
constexpr bool UNSAFE = false;
constexpr int GLOB_BUF_SIZE = 1 << 15;
#ifndef DEBUG
#define CHANGE_DEFAULT_STREAMS
static struct FastInput {
FastInput() {
if constexpr (UNSAFE) {
chars_read = fread(buf, 1, BUF_SIZE, in);
buf_pos = 0;
buf[0] = (chars_read == 0 ? -1 : buf[0]);
}
}
static constexpr int BUF_SIZE = GLOB_BUF_SIZE;
char buf[BUF_SIZE];
size_t chars_read = 0;
size_t buf_pos = 0;
FILE* in = stdin;
char cur = 0;
inline char get_char() {
if constexpr (!UNSAFE) {
if (buf_pos >= chars_read) {
chars_read = fread(buf, 1, BUF_SIZE, in);
buf_pos = 0;
buf[0] = (chars_read == 0 ? -1 : buf[0]);
}
}
return cur = buf[buf_pos++];
}
template <typename T>
inline FastInput* tie(T) {
return this;
}
inline void sync_with_stdio(bool) {}
inline explicit operator bool() { return cur != -1; }
inline static bool is_blank(char c) { return c <= ' '; }
inline bool skip_blanks() {
while (is_blank(cur) && cur != -1) get_char();
return cur != -1;
}
inline FastInput& operator>>(char& c) {
skip_blanks();
c = cur;
return *this;
}
inline FastInput& operator>>(std::string& s) {
if (skip_blanks()) {
s.clear();
do {
s += cur;
} while (!is_blank(get_char()));
}
return *this;
}
template <typename T>
inline FastInput& read_integer(T& n) {
// unsafe, doesn't check that characters are actually digits
n = 0;
if (skip_blanks()) {
int sign = +1;
if (cur == '-') {
sign = -1;
get_char();
}
do {
n += n + (n << 3) + cur - '0';
} while (!is_blank(get_char()));
n *= sign;
}
return *this;
}
template <typename T>
inline typename std::enable_if<std::is_integral<T>::value, FastInput&>::type
operator>>(T& n) {
return read_integer(n);
}
#if !defined(_WIN32) || defined(_WIN64)
inline FastInput& operator>>(__int128& n) { return read_integer(n); }
#endif
template <typename T>
inline typename std::enable_if<std::is_floating_point<T>::value,
FastInput&>::type
operator>>(T& n) {
// not sure if really fast, for compatibility only
n = 0;
if (skip_blanks()) {
std::string s;
(*this) >> s;
sscanf(s.c_str(), "%lf", &n);
}
return *this;
}
} fast_input;
#define cin IO::fast_input
static struct FastOutput {
static constexpr int BUF_SIZE = GLOB_BUF_SIZE;
char buf[BUF_SIZE];
size_t buf_pos = 0;
static constexpr int TMP_SIZE = GLOB_BUF_SIZE;
char tmp[TMP_SIZE];
FILE* out = stdout;
inline void put_char(char c) {
buf[buf_pos++] = c;
if (buf_pos == BUF_SIZE) {
fwrite(buf, 1, buf_pos, out);
buf_pos = 0;
}
}
~FastOutput() { fwrite(buf, 1, buf_pos, out); }
inline FastOutput& operator<<(char c) {
put_char(c);
return *this;
}
inline FastOutput& operator<<(const char* s) {
while (*s) put_char(*s++);
return *this;
}
inline FastOutput& operator<<(const std::string& s) {
for (auto x : s) put_char(x);
return *this;
}
template <typename T>
inline char* integer_to_string(T n) {
// beware of TMP_SIZE
char* p = tmp + TMP_SIZE - 1;
if (n == 0)
*--p = '0';
else {
bool is_negative = false;
if (n < 0) {
is_negative = true;
n = -n;
}
while (n > 0) {
*--p = (char)('0' + n % 10);
n /= 10;
}
if (is_negative) *--p = '-';
}
return p;
}
template <typename T>
inline typename std::enable_if<std::is_integral<T>::value, char*>::type
stringify(T n) {
return integer_to_string(n);
}
#if !defined(_WIN32) || defined(_WIN64)
inline char* stringify(__int128 n) { return integer_to_string(n); }
#endif
template <typename T>
inline typename std::enable_if<std::is_floating_point<T>::value, char*>::type
stringify(T n) {
sprintf(tmp, "%.17f", n);
return tmp;
}
template <typename T>
inline FastOutput& operator<<(const T& n) {
auto p = stringify(n);
for (; *p != 0; p++) put_char(*p);
return *this;
}
} fast_output;
#define cout IO::fast_output
#endif
} // namespace IO
int32_t main() {
std::ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n1, n2, m;
cin >> n1 >> n2 >> m;
std::vector<std::pair<int, int>> edg(m);
for (auto& [u, v] : edg) {
cin >> u >> v;
v += n1;
}
std::mt19937 rnd(2086);
std::shuffle(edg.begin(), edg.end(), rnd);
clock_t beg = clock();
auto ans = bipartite_matching(n1 + n2, edg);
cout << (int)ans.size() << '\n';
for (auto [u, v] : ans) {
cout << u << ' ' << v - n1 << '\n';
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 47ms
memory: 13164kb
input:
100000 100000 200000 78474 45795 32144 46392 92549 13903 73460 34144 96460 92850 56318 77066 77529 84436 76342 51542 77506 99268 76410 89381 1778 61392 43607 96135 84268 74827 14857 35966 32084 94908 19876 174 1481 94390 12423 55019 64368 92587 81295 7902 25432 46032 36293 61128 73555 84836 8418 102...
output:
100000 0 54731 1 26066 2 89637 3 1717 4 68505 5 28330 6 55261 7 34703 8 42170 9 23249 10 90437 11 69580 12 72086 13 47593 14 29944 15 87183 16 763 17 2814 18 46044 19 75228 20 11487 21 72701 22 60611 23 36775 24 66081 25 45592 26 3321 27 88211 28 71467 29 47516 30 55528 31 83162 32 46298 33 26459 34...
result:
ok OK
Test #2:
score: 0
Accepted
time: 50ms
memory: 13296kb
input:
100000 100000 200000 56815 52516 2576 76201 40377 1757 50463 66496 15833 50879 9828 16330 80692 9962 51095 17590 15870 35191 91301 65509 90774 57492 11890 8966 44786 41895 3386 35478 93470 47452 84803 93635 90745 34876 18201 38717 7472 34257 36580 19532 13248 27524 6441 69869 8821 61870 94536 67713 ...
output:
100000 0 48685 1 54562 2 96282 3 43660 4 56572 5 72097 6 31793 7 12360 8 3023 9 14651 10 80163 11 12379 12 597 13 39076 14 77674 15 94527 16 85130 17 23849 18 35846 19 78842 20 26940 21 93329 22 69417 23 49345 24 65215 25 36147 26 45930 27 84619 28 76814 29 412 30 10858 31 38186 32 60852 33 64942 34...
result:
ok OK
Test #3:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
4 4 7 1 1 2 2 0 0 3 1 1 2 2 0 3 2
output:
3 0 0 1 2 3 1
result:
ok OK
Test #4:
score: 0
Accepted
time: 13ms
memory: 13228kb
input:
100000 100000 199999 25370 25370 85964 85963 415 415 16796 16796 12437 12437 45409 45408 63005 63004 22155 22155 87828 87827 84013 84013 37307 37307 72324 72324 83703 83703 55390 55389 6780 6779 78090 78090 9375 9375 82192 82192 74694 74694 49841 49841 15798 15798 69855 69854 82948 82947 97389 97388...
output:
100000 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 5...
result:
ok OK
Test #5:
score: 0
Accepted
time: 15ms
memory: 13408kb
input:
100000 100000 199999 59469 59469 76773 76772 89516 89516 87040 87040 90184 90184 83075 83075 61454 61454 33615 33615 85794 85793 92072 92071 49725 49725 63842 63841 99247 99247 24121 24121 29552 29551 73533 73533 75845 75845 27029 27028 84418 84418 26636 26636 10100 10099 75013 75012 67341 67341 756...
output:
100000 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 5...
result:
ok OK
Test #6:
score: 0
Accepted
time: 45ms
memory: 13280kb
input:
100000 100000 199999 22284 45795 32144 44930 58734 13903 57136 34144 7548 92850 56318 11874 77529 85278 27039 51542 77506 94257 69265 89381 67073 61392 86159 96135 83227 74827 14857 19500 32084 73639 86884 174 27268 94390 20020 55019 45357 92587 17833 7902 55801 46032 36293 46557 73555 13746 8418 88...
output:
100000 0 2401 1 18084 2 59700 3 99457 4 33291 5 38417 6 97167 7 64564 8 28471 9 68817 10 62095 11 31609 12 57675 13 28348 14 2599 15 99163 16 58923 17 17629 18 3975 19 53920 20 25930 21 4206 22 49364 23 55768 24 40573 25 87244 26 12858 27 39608 28 42953 29 68974 30 89214 31 48329 32 3980 33 50041 34...
result:
ok OK
Test #7:
score: 0
Accepted
time: 50ms
memory: 13196kb
input:
100000 100000 199999 4850 52516 2576 29250 69016 1757 85854 66496 48300 50879 83741 16330 98931 9962 38730 17590 15870 13960 91301 97595 81692 57492 11890 59332 5076 41895 23574 35478 93470 65245 61976 93635 96140 34876 18201 35366 64057 34257 25588 19532 13248 91003 6441 83448 99191 61870 94536 169...
output:
100000 0 39785 1 26716 2 6189 3 33390 4 12388 5 6804 6 66264 7 36155 8 25212 9 73214 10 29914 11 87445 12 9428 13 44486 14 83326 15 61240 16 63409 17 15512 18 77732 19 17216 20 39374 21 7319 22 36983 23 45568 24 34087 25 31512 26 83824 27 73657 28 80853 29 58211 30 14867 31 17935 32 49451 33 91463 3...
result:
ok OK
Test #8:
score: 0
Accepted
time: 23ms
memory: 10764kb
input:
61217 61379 199943 14003 13749 24504 24347 30371 30219 27661 27461 33247 33397 38346 38157 17300 16944 50476 50643 56488 56551 46690 46949 21355 21288 3899 3659 24330 24165 8806 8305 40957 40994 15089 14813 20397 20389 30864 30800 33635 33755 20900 20808 55447 55499 4335 4040 36726 36551 16496 16095...
output:
37154 0 0 11 7 12 6 13 10 14 2 15 5 16 1 17 13 18 11 19 9 20 3 21 12 22 15 23 14 30 30 31 27 32 24 33 28 34 22 35 20 36 46 39 39 41 44 42 38 44 40 45 45 49 55 50 53 51 54 52 52 53 51 64 65 66 57 70 61 71 63 79 73 80 70 81 69 83 71 84 74 85 68 87 77 88 78 89 76 90 75 93 80 101 79 107 85 109 96 111 95...
result:
ok OK
Test #9:
score: 0
Accepted
time: 23ms
memory: 10724kb
input:
61352 60513 199960 2270 2419 38842 39327 48788 48843 2493 2635 40183 40659 59754 59010 48980 48993 52508 52276 12892 13195 33811 34565 40260 40700 2116 2289 11742 12133 29439 29942 4256 4392 51422 51263 44695 44994 21600 22165 21666 22208 26472 26785 49979 50038 12099 12515 10539 10816 32736 33401 3...
output:
37442 0 1 1 9 2 10 3 4 4 7 5 3 7 20 8 22 9 13 10 18 11 26 12 24 13 25 14 28 15 33 17 37 18 35 19 38 20 34 23 36 32 39 33 51 34 56 35 54 36 62 37 68 38 72 39 70 40 74 41 76 42 71 43 73 44 75 48 69 52 77 53 82 54 87 55 81 56 86 57 79 58 83 59 88 60 78 61 84 62 85 63 80 64 97 65 98 66 101 67 92 68 90 6...
result:
ok OK
Test #10:
score: 0
Accepted
time: 35ms
memory: 13324kb
input:
100000 100000 199998 0 13805 0 33641 1 9259 1 62738 1 70691 1 78118 2 41148 3 15765 3 50059 4 96644 5 91521 6 32562 8 2550 8 11396 8 48345 9 14639 9 51057 9 79293 9 92374 10 64733 10 67020 11 7764 11 46822 11 60302 12 8749 12 27869 12 69569 12 71510 13 35684 13 42579 13 82023 14 34778 15 1975 15 693...
output:
78404 0 13805 1 62738 2 41148 3 15765 4 96644 5 91521 6 32562 8 2550 9 79293 10 67020 11 60302 12 71510 13 42579 14 34778 15 69322 16 57308 17 6162 18 9164 19 64579 21 24593 22 94934 23 77417 24 47998 25 94820 27 53506 28 35478 29 65316 30 31954 31 19608 32 71996 34 64699 35 72885 36 89653 37 57779 ...
result:
ok OK
Test #11:
score: 0
Accepted
time: 35ms
memory: 13268kb
input:
100000 100000 199998 0 28389 0 41333 0 66666 1 5984 1 15912 3 63753 3 77735 4 25015 4 30450 4 90212 5 66978 5 98909 6 63465 6 78227 6 78950 6 85422 7 1743 7 1868 7 55171 8 37582 9 26491 9 82984 10 29229 10 29811 10 33063 11 10609 11 48601 11 73298 11 95658 12 29064 12 50261 12 63186 12 68616 13 8683...
output:
78497 0 41333 1 15912 3 63753 4 30450 5 98909 6 63465 7 1868 8 37582 9 26491 10 33063 11 95658 12 68616 13 86837 14 61234 15 77990 16 10803 17 23926 18 93717 19 32559 21 91488 23 47490 24 34533 25 47612 26 36458 27 33773 28 89481 29 83766 30 28313 31 82347 32 28749 33 96004 34 35265 35 82877 36 9336...
result:
ok OK
Test #12:
score: 0
Accepted
time: 36ms
memory: 13284kb
input:
100000 100000 199997 0 4357 0 35525 0 51857 1 57468 1 94927 1 96004 3 75468 4 20202 4 37102 5 32207 6 8677 6 16775 6 46813 6 75640 7 30806 8 4099 8 26454 8 49376 8 55539 8 67032 9 82362 10 11387 10 33778 10 35352 10 50533 10 54706 11 44868 11 59104 14 80528 14 90600 14 99752 15 10954 15 80519 15 873...
output:
78379 0 51857 1 57468 3 75468 4 20202 5 32207 6 46813 7 30806 8 26454 9 82362 10 54706 11 59104 14 80528 15 10954 16 32645 17 88162 18 52112 19 49350 20 58977 21 31926 22 50244 23 5726 24 92464 26 52648 27 57836 28 96888 30 50525 31 76950 32 73647 33 971 34 50898 35 81872 36 660 37 65791 38 55672 39...
result:
ok OK
Test #13:
score: 0
Accepted
time: 6ms
memory: 6672kb
input:
17707 77101 11866 4 29611 4 62770 4 65605 5 22177 5 57724 14 59632 14 68649 17 9622 18 9221 18 43355 29 19612 30 44428 32 51277 34 53196 35 20939 37 68142 38 34663 38 36432 39 71932 40 62217 41 40291 43 53542 44 22018 44 60539 47 56819 47 76081 49 18326 50 52876 50 58006 51 64709 51 66011 52 26751 5...
output:
8453 4 62770 5 57724 14 59632 17 9622 18 43355 29 19612 30 44428 32 51277 34 53196 35 20939 37 68142 38 36432 39 71932 40 62217 41 40291 43 53542 44 60539 47 56819 49 18326 50 58006 51 66011 52 45116 54 5453 55 72966 57 3550 58 64790 59 16851 60 49400 62 16210 67 18050 68 27089 70 47489 71 41622 73 ...
result:
ok OK
Test #14:
score: 0
Accepted
time: 16ms
memory: 8764kb
input:
69830 19691 148749 0 8565 0 12093 0 12608 2 777 2 8771 3 6106 3 7526 3 10596 3 12199 3 14674 3 17676 4 4643 4 15016 4 17194 6 6948 7 1743 7 7750 8 2305 8 4814 9 4468 9 12246 9 16763 9 17448 10 295 10 12043 10 13971 11 168 11 4447 11 7762 11 15833 11 15993 12 1914 12 3080 12 5649 14 29 15 1675 15 464...
output:
19684 0 12608 2 8771 3 10596 4 15016 6 6948 7 1743 8 2305 9 12246 10 295 11 15833 12 1914 14 29 15 6650 16 14896 17 2094 18 6627 20 5430 21 2154 22 1202 23 100 24 10576 25 95 26 612 27 7922 29 18230 30 6797 31 16811 32 1090 33 10648 34 12333 36 1439 37 5898 38 2502 40 6932 41 11238 42 1070 43 18334 ...
result:
ok OK
Test #15:
score: 0
Accepted
time: 18ms
memory: 8816kb
input:
53336 61958 92222 0 23730 0 34075 0 35525 1 30468 1 61015 3 24509 3 36308 4 8061 4 45185 4 54435 5 32530 5 59288 6 10104 6 56657 10 2203 10 3106 10 33778 11 29821 11 59104 12 27897 14 18850 15 13472 15 14983 15 37131 15 40140 15 49346 15 59901 16 12876 16 32645 18 26571 21 60370 22 39980 22 41044 22...
output:
40194 0 23730 1 61015 3 24509 4 8061 5 59288 6 10104 10 2203 11 29821 12 27897 14 18850 15 14983 16 12876 18 26571 21 60370 22 61185 23 59945 24 17646 25 7805 26 55641 27 47048 28 37215 29 61757 30 51900 32 18385 33 14342 34 19082 35 30280 36 24688 37 59801 39 53021 40 21280 42 10909 43 28881 44 124...
result:
ok OK
Test #16:
score: 0
Accepted
time: 15ms
memory: 7720kb
input:
36033 25839 130375 0 1577 0 16725 0 22301 0 24558 1 5977 1 6738 1 9339 1 25294 2 762 2 6992 2 10207 2 14608 3 3 3 3002 3 25047 4 12402 4 13815 4 15862 5 4727 6 6680 6 8345 6 10057 6 13352 6 17084 7 9878 7 17893 7 21628 7 23892 8 2601 8 13004 8 19099 8 23028 9 2307 9 13011 9 15776 9 22642 11 7388 11 ...
output:
25668 0 16725 1 25294 2 6992 3 3 4 13815 5 4727 6 8345 7 23892 8 13004 9 13011 11 10686 13 23460 14 25125 15 18084 17 15913 18 918 19 9493 20 21594 21 9834 22 21470 23 10340 24 15017 25 11798 26 22027 27 22575 28 5879 29 407 30 20604 31 20612 32 19736 33 25682 34 25554 35 16587 37 165 38 17879 39 50...
result:
ok OK
Test #17:
score: 0
Accepted
time: 8ms
memory: 7400kb
input:
14868 99117 25214 0 19546 0 37951 1 13804 1 18263 1 38541 1 49319 1 64693 1 81665 1 91777 2 2159 2 8896 4 38134 5 3464 5 52631 6 85971 6 92674 7 5530 7 12991 7 35465 8 12077 8 71946 9 57520 11 75486 11 95227 12 83001 13 83429 13 85532 15 32388 15 49234 15 87159 16 70733 16 95797 17 45027 18 51284 20...
output:
12003 0 19546 1 91777 2 8896 4 38134 5 3464 6 85971 7 5530 8 12077 9 57520 11 95227 12 83001 13 85532 15 32388 16 70733 17 45027 18 51284 20 59547 21 5520 23 86112 26 29339 27 7626 28 31861 30 6132 33 30727 34 40008 37 81810 38 72113 39 11712 40 81311 41 73351 43 49309 44 83232 46 77294 47 92399 48 ...
result:
ok OK
Test #18:
score: 0
Accepted
time: 8ms
memory: 6372kb
input:
53098 9437 57924 0 262 0 3336 0 7251 2 2976 3 4877 4 3403 4 8279 5 4742 6 2961 6 8901 8 5979 8 8808 9 7822 10 415 12 969 13 1058 15 3592 17 5759 18 7128 19 4461 19 9343 20 5011 20 8942 21 8414 22 5217 22 5266 22 5455 23 5698 23 8697 24 5855 25 1211 25 2830 28 3685 29 1866 29 8645 32 6955 32 7045 33 ...
output:
9415 0 262 2 2976 3 4877 4 8279 5 4742 6 2961 8 5979 9 7822 10 415 12 969 13 1058 15 3592 17 5759 18 7128 19 9343 20 5011 21 8414 22 5455 23 8697 24 5855 25 1211 28 3685 29 1866 32 7045 33 2484 34 7733 36 5002 37 7754 40 5766 43 5144 44 1709 45 2552 46 6881 47 901 49 1104 50 7235 51 1309 52 4351 55 ...
result:
ok OK
Test #19:
score: 0
Accepted
time: 29ms
memory: 10128kb
input:
62342 62612 153201 0 1819 1 26257 1 34654 1 41966 2 9609 3 19007 3 31306 3 36054 4 36681 4 42043 4 46885 4 54123 5 35272 5 48535 6 9177 6 44477 7 11189 7 17566 7 41426 7 53724 8 13815 8 36015 8 48166 10 1144 10 2928 10 21148 10 21677 10 46645 12 39907 12 53275 13 52579 14 21089 15 39807 16 46513 17 ...
output:
53671 0 1819 1 41966 2 9609 3 31306 4 36681 5 35272 6 9177 7 17566 8 48166 10 1144 12 53275 13 52579 14 21089 15 39807 16 46513 17 57314 18 48300 19 49799 20 58031 21 6661 22 30788 24 43728 27 53143 28 60322 29 62025 30 49076 31 33829 32 22621 33 23347 34 12047 36 9660 37 13583 38 903 39 28697 40 40...
result:
ok OK
Test #20:
score: 0
Accepted
time: 4ms
memory: 7196kb
input:
95835 11475 31126 7 7489 10 1813 17 1852 18 9253 21 2999 25 1649 28 7088 33 4068 33 6119 34 5651 39 10350 41 5703 43 7512 51 3934 52 4246 55 4275 55 6549 64 8185 66 10080 67 10332 73 6343 73 6432 80 8844 86 1764 87 5646 92 399 95 509 95 9564 102 10598 107 582 121 5613 122 5866 123 7063 125 4180 125 ...
output:
10716 7 7489 10 1813 17 1852 18 9253 21 2999 25 1649 28 7088 33 6119 34 5651 39 10350 41 5703 43 7512 51 3934 52 4246 55 6549 64 8185 66 10080 67 10332 73 6343 80 8844 86 1764 87 5646 92 399 95 509 102 10598 107 582 121 5613 122 5866 123 7063 125 4180 126 4185 137 7604 138 8662 140 9700 141 7624 144...
result:
ok OK
Test #21:
score: 0
Accepted
time: 13ms
memory: 8196kb
input:
5824 49455 192460 0 451 0 2959 0 4380 0 4902 0 9092 0 9318 0 10189 0 11109 0 13730 0 15872 0 17604 0 18557 0 19327 0 19871 0 21171 0 24112 0 26985 0 28368 0 28474 0 29569 0 30903 0 31861 0 35960 0 36791 0 38654 0 40350 0 46164 0 46921 0 47526 0 48226 0 48323 0 48592 0 49186 1 2866 1 8429 1 9731 1 98...
output:
5824 0 30903 1 38625 2 43584 3 10294 4 33881 5 35329 6 8049 7 4493 8 25997 9 8503 10 49142 11 5616 12 26972 13 46573 14 8572 15 38551 16 37352 17 18478 18 15143 19 8079 20 30470 21 34971 22 15248 23 29731 24 6110 25 46018 26 20101 27 35353 28 20355 29 30562 30 9952 31 19322 32 69 33 48549 34 6614 35...
result:
ok OK
Test #22:
score: 0
Accepted
time: 18ms
memory: 8672kb
input:
64506 23320 150593 0 4768 0 10542 0 14842 0 20602 1 1266 1 12253 2 471 2 13145 2 14023 2 15190 2 18272 2 22689 4 8149 4 9069 6 357 6 10397 6 10869 6 16797 7 5497 7 19179 8 3468 8 6448 8 11473 8 12455 8 13155 9 751 10 11245 11 10586 11 13266 11 17148 11 20206 11 22535 12 5515 13 374 13 19047 14 11867...
output:
23290 0 14842 1 1266 2 13145 4 8149 6 357 7 19179 8 3468 9 751 10 11245 11 17148 12 5515 13 19047 14 18726 15 15514 16 1166 17 5002 18 6391 20 5047 21 4574 22 3062 23 9135 24 10882 25 2182 26 437 27 19434 28 1250 29 16020 30 10358 31 7475 32 21280 33 19339 34 110 35 15703 36 2653 37 15801 38 2814 39...
result:
ok OK