QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#188519 | #7235. Points | ucup-team004 | TL | 3627ms | 5188kb | C++20 | 4.3kb | 2023-09-25 22:23:28 | 2023-09-25 22:23:29 |
Judging History
answer
#include <bits/stdc++.h>
using i64 = long long;
using Int = __int128;
struct Point {
Int x = 0;
Int y = 0;
Int z = 0;
};
Point operator+(const Point &a, const Point &b) {
return {a.x + b.x, a.y + b.y, a.z + b.z};
}
Point operator-(const Point &a, const Point &b) {
return {a.x - b.x, a.y - b.y, a.z - b.z};
}
Point cross(const Point &a, const Point &b) {
return {
a.y * b.z - a.z * b.y,
a.z * b.x - a.x * b.z,
a.x * b.y - a.y * b.x
};
}
Int dot(const Point &a, const Point &b) {
return a.x * b.x + a.y * b.y + a.z * b.z;
}
void solve() {
int n, k;
std::cin >> n >> k;
i64 ans = -1;
i64 set = 0;
std::vector<Point> a(n);
for (int i = 0; i < n; i++) {
int x, y, z;
std::cin >> x >> y >> z;
a[i] = {x, y, z};
}
std::set<std::array<i64, 3>> vis;
vis.insert({0, 0, 0});
auto check = [&](const Point &v) {
if (vis.count({v.x, v.y, v.z})) {
return;
}
vis.insert({v.x, v.y, v.z});
std::vector<int> p(n);
std::iota(p.begin(), p.end(), 0);
std::sort(p.begin(), p.end(),
[&](int i, int j) {
return dot(v, a[i]) > dot(v, a[j]);
});
auto update = [&]() {
Point sum;
for (int i = 0; i < k; i++) {
sum = sum + a[p[i]];
}
i64 res = dot(sum, sum);
if (res > ans) {
ans = res;
set = 0;
for (int i = 0; i < k; i++) {
set |= 1LL << p[i];
}
}
};
update();
if (k < n && dot(a[p[k - 1]], v) == dot(a[p[k]], v)) {
auto d = dot(a[p[k - 1]], v);
int l = k - 1, r = k + 1;
while (l > 0 && dot(a[p[l - 1]], v) == d) {
l--;
}
while (r < n && dot(a[p[r]], v) == d) {
r++;
}
for (int i = l; i < r; i++) {
for (int j = l; j < r; j++) {
if (i == j) {
continue;
}
Point u = cross(v, a[j] - a[i]);
Point vu = cross(v, u);
std::sort(p.begin() + l, p.begin() + r,
[&](int i, int j) {
auto di = dot(u, a[i]);
auto dj = dot(u, a[j]);
if (di != dj) {
return di > dj;
}
return dot(vu, a[i]) > dot(vu, a[j]);
});
update();
if (dot(a[p[k - 1]], u) == dot(a[p[k]], u)) {
auto d = dot(a[p[k - 1]], u);
int l = k - 1, r = k + 1;
while (l > 0 && dot(a[p[l - 1]], u) == d) {
l--;
}
while (r < n && dot(a[p[r]], u) == d) {
r++;
}
std::reverse(p.begin() + l, p.begin() + r);
update();
}
}
}
}
};
check({1, 0, 0});
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
check(cross(a[j] - a[i], {1, 0, 0}));
check(cross(a[j] - a[i], {0, 1, 0}));
}
}
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
for (int k = j + 1; k < n; k++) {
check(cross(a[j] - a[i], a[k] - a[i]));
check(cross(a[k] - a[i], a[j] - a[i]));
}
}
}
std::vector<int> p;
for (int i = 0; i < n; i++) {
if (set >> i & 1) {
p.push_back(i + 1);
}
}
std::cout << ans << "\n";
for (int i = 0; i < k; i++) {
std::cout << p[i] << " \n"[i == k - 1];
}
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int t;
std::cin >> t;
while (t--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3688kb
input:
2 3 1 4 2 6 4 9 7 6 4 2 3 2 7 3 2 8 2 4 4 7 9
output:
146 2 394 2 3
result:
ok Correct (2 tests)
Test #2:
score: 0
Accepted
time: 2ms
memory: 3668kb
input:
48 3 1 506486 41876 692904 165261 762859 246395 781549 425052 316880 8 2 525015 8224 970327 874558 80119 462001 290805 478077 274544 39054 312160 524182 199036 939842 834707 951223 75070 806760 548951 460563 421778 513649 561297 743730 4 1 817567 315632 508886 99778 825028 141365 311062 215938 94373...
output:
891900976505 3 5344254728649 1 6 1925054261378 4 4272030273153 1 2 5862467200611 1 2 9221910684849 1 2 3 1216569228449 1 17835055670598 1 4 5 7 1341292964490 1 29357482136450 2 3 4 5 6 1764061360298 3 538912373466 1 1312222964918 7 1300748107849 7 14803216579502 1 2 4 12152396511653 2 4 6 2738257866...
result:
ok Correct (48 tests)
Test #3:
score: 0
Accepted
time: 239ms
memory: 5020kb
input:
5 40 11 91406 989734 719664 162744 233803 716286 917527 609704 351890 282 578278 154507 39455 956096 454235 34402 773703 937545 67001 729884 613200 675806 111928 752155 594666 410066 824852 805401 682493 981233 563377 19394 647273 418154 871916 968817 401635 747220 410569 630989 482086 942247 77540 ...
output:
187060263705194 1 6 10 12 14 20 22 26 31 34 36 124998725467970 5 7 16 20 25 26 32 36 40 2195304412433 38 232358148617701 4 10 15 17 21 23 24 27 31 33 35 36 545828153932010 2 4 5 8 11 12 13 14 15 16 17 18 20 23 25 27 29 30 31 33 35 37 38 40
result:
ok Correct (5 tests)
Test #4:
score: 0
Accepted
time: 241ms
memory: 5020kb
input:
5 40 11 975201 157117 823907 377477 706020 936201 82313 746315 662425 749918 846757 36545 300634 66810 536521 646285 838896 476880 969977 890821 956051 79120 56878 358487 42853 353666 443931 210689 535541 994724 865120 233867 933178 168067 136322 925983 489035 998073 360565 716885 459314 158325 2065...
output:
166388273446435 1 2 6 7 10 11 13 27 29 34 38 1243844474979594 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 33 34 35 36 37 38 39 40 174143603315691 3 4 8 9 18 21 22 32 34 35 38 49888757165161 1 2 12 23 39 1036192198522043 2 3 4 5 6 7 8 9 10 11 12 13 15 16 17 19 20...
result:
ok Correct (5 tests)
Test #5:
score: 0
Accepted
time: 243ms
memory: 5132kb
input:
5 40 27 377494 805316 409650 555211 215919 562932 728601 882925 491459 981054 115920 400084 561128 770707 618806 738984 423273 497716 909952 570941 336586 482436 558013 483318 416358 778767 582195 135162 351591 452031 647678 929155 182083 399480 918545 401648 57249 285925 829062 728097 843359 893588...
output:
844749482389573 1 3 4 5 6 7 8 9 11 12 14 19 20 21 22 23 26 27 28 29 32 33 34 35 36 38 39 706227580053281 1 3 4 5 7 8 10 11 12 13 14 15 16 19 20 21 22 23 24 25 26 29 32 34 35 36 38 1200413036531411 1 3 4 5 6 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 34 35 36 37 38 39 40...
result:
ok Correct (5 tests)
Test #6:
score: 0
Accepted
time: 246ms
memory: 4980kb
input:
5 40 19 186606 972700 513893 732260 651137 745163 893388 575034 801995 175190 940583 725940 822306 881422 738091 350866 488466 518552 775243 213377 754121 848068 502963 89650 346047 722366 201275 21951 204639 909339 949422 143627 467989 705576 182951 395813 106964 18279 778373 776993 302086 665850 5...
output:
429855995296682 1 2 3 4 5 7 14 15 18 19 22 24 28 30 33 34 35 36 38 583568280834554 1 2 4 5 6 7 8 12 14 15 17 18 19 21 24 25 27 28 30 31 34 38 39 40 1007766487925869 1 2 3 4 5 6 7 8 9 12 13 15 18 19 20 21 22 23 24 26 27 28 30 31 33 34 36 37 38 39 40 1143756451547234 1 2 3 4 5 6 7 8 9 10 11 12 14 15 1...
result:
ok Correct (5 tests)
Test #7:
score: 0
Accepted
time: 240ms
memory: 5124kb
input:
5 40 35 70400 139398 99636 946992 123352 446578 21175 711645 112529 924825 209746 570979 82799 585318 858060 962064 109842 57887 715218 855814 578473 769882 3412 695982 757236 665966 820355 464924 539188 367331 213480 358100 716895 973989 928174 834480 675180 269133 246868 306705 686131 881928 63074...
output:
1052258845078241 2 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 29 30 31 32 33 36 37 38 39 40 225439517955660 7 13 14 16 17 18 24 26 27 28 38 39 10309247698229 34 35 867716207500786 2 4 5 6 7 8 9 10 11 12 13 14 15 16 19 20 21 23 24 25 26 27 30 31 32 34 35 36 37 38 39 16722490898...
result:
ok Correct (5 tests)
Test #8:
score: 0
Accepted
time: 246ms
memory: 5132kb
input:
5 40 35 917196 787598 241562 161724 596253 591809 704462 848256 904565 118276 515909 934518 862478 696033 940346 573946 175036 115722 580509 54434 959009 173197 948364 820814 167739 91065 958620 389398 354552 824639 996724 128070 2799 205401 229579 828645 280393 556985 233864 355601 144859 617191 75...
output:
1070384528063876 1 2 3 4 5 7 8 9 10 11 12 13 14 15 16 17 19 20 21 22 23 24 25 26 28 30 31 32 33 34 35 36 37 38 40 394240112203646 2 4 7 9 10 14 15 16 18 22 27 30 33 34 37 39 40 728666969687926 1 3 4 5 7 8 10 11 12 13 14 15 16 17 18 20 22 23 24 26 27 28 32 33 34 37 38 39 82383556555352 10 11 16 17 21...
result:
ok Correct (5 tests)
Test #9:
score: 0
Accepted
time: 242ms
memory: 5128kb
input:
5 40 11 800990 954982 827306 338773 586969 293224 869249 21864 252098 867912 747388 298056 122970 362245 22631 148145 796413 655058 483484 696871 339544 539514 411813 464144 578928 34665 577699 757688 170601 281946 260782 304859 251705 955314 974802 822810 330109 807839 627677 366814 566588 389452 9...
output:
188816088990549 1 4 12 18 19 22 24 33 35 37 40 55986183043314 11 14 16 30 31 33 282684586984324 9 14 15 16 17 20 23 26 27 30 33 37 38 40 846786488121493 1 2 3 4 5 6 7 8 9 10 12 13 14 15 16 18 21 22 23 24 25 26 28 29 30 32 34 35 36 37 39 40 909377300034056 1 2 3 4 5 6 8 9 10 11 13 14 15 16 18 21 22 2...
result:
ok Correct (5 tests)
Test #10:
score: 0
Accepted
time: 243ms
memory: 4920kb
input:
5 40 3 203283 84680 931549 516507 59184 956956 515536 158475 562633 99047 53550 180094 384149 510644 104916 240843 861606 675894 941959 339307 720080 905145 912948 70476 990117 15264 715279 682161 23649 776938 599524 37830 537610 224411 239208 261476 898324 58692 614672 452709 987632 643215 92587 86...
output:
16250708007685 24 34 35 147504726678494 6 7 8 12 20 24 27 31 34 39 1041145136990273 1 2 3 5 6 7 8 11 12 13 14 17 18 20 21 22 23 24 25 26 27 28 29 30 31 33 34 36 37 38 39 40 365124481934200 1 2 5 6 9 12 14 18 19 20 26 28 31 34 37 38 39 15221561015297 24 30 33
result:
ok Correct (5 tests)
Test #11:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
50 8 7 563558 314099 52734 73377 332270 590552 646972 765944 98713 556129 288028 758164 572776 499897 97667 406801 801149 614476 545426 120879 38843 839594 877525 651356 8 3 226356 669424 469393 550063 173289 794466 908445 160219 504986 479445 444909 370083 264919 94919 590823 896708 51840 965987 36...
output:
36636314222837 1 2 3 4 5 6 8 10827749350481 2 3 6 6028750536179 1 3 48041933857901 1 3 5 6 7 8 625569455729 1 1750997852217 1 21861637683545 1 2 3 4 5 288208217585 1 4683255035576 2 4 13621537943579 2 3 4 912021979641 1 9666522356917 1 2 3 3977134723358 1 2 7099096890122 3 4 344454534014 1 121600836...
result:
ok Correct (50 tests)
Test #12:
score: 0
Accepted
time: 2ms
memory: 3664kb
input:
42 8 5 693258 456026 267467 101777 996002 236839 302082 557979 848349 787609 651567 981659 758174 619181 708865 991179 340484 517451 225546 463731 404475 303044 483857 24860 7 5 113145 966974 926701 814123 387762 43371 176856 424626 980651 566844 177262 357078 350814 553647 326086 25759 609908 87483...
output:
30416613337054 1 3 4 5 6 23605437783397 1 3 5 6 7 5849092179176 3 5 11261875153385 1 3 4 23602712610269 2 3 5 7 8 6679075420437 1 2 8325919927643 1 2 3 1571454158554 1 11564587559234 1 2 6 450854953666 1 4440359099257 3 4 16942435341514 1 2 3 4 5 45357060723386 1 3 4 5 7 8 6783087313137 1 2 3 913397...
result:
ok Correct (42 tests)
Test #13:
score: 0
Accepted
time: 2ms
memory: 3600kb
input:
43 6 2 918089 70120 662830 696025 354138 958971 444347 32956 299658 841774 155081 200910 388637 626360 20902 623655 336603 908094 4 1 894338 310421 883479 800116 101306 544201 539198 167785 610871 99691 313951 418576 5 1 188758 128411 394398 202942 248070 631201 818961 821071 498206 22239 12758 2280...
output:
5704610145706 2 6 1676736798926 1 1593063924998 3 14251355469449 1 2 3 4 1096252946965 1 38930442504849 1 2 4 5 6 7 6163651905025 1 2 1597770732442 1 2 16958423501362 1 2 3 4 34443636314757 1 2 3 4 5 35910186363794 1 2 3 5 8 1972461337182 1 6128116718517 1 2 3 24702844316246 1 2 5 6 4697948502254 1 ...
result:
ok Correct (43 tests)
Test #14:
score: 0
Accepted
time: 1ms
memory: 3852kb
input:
49 6 2 47788 174362 877563 168241 17868 123757 580958 343491 493795 110937 37119 979903 92533 708646 151284 689533 357439 811069 6 5 259969 255372 489810 211304 44905 681781 500671 20834 31179 919935 528424 667482 959175 993068 664424 178126 682250 671438 2 1 591222 950123 56273 893406 995519 129606...
output:
4004008941048 4 6 22743681169667 1 2 4 5 6 1806030075433 2 1327787282705 1 17236534698595 1 2 4 1598551642742 1 6865902267377 1 2 3 901648881714 1 4563161074281 3 4 34109116625025 1 3 4 5 6 7 1188113278325 1 5934299446715 1 2 3 1238991966091 1 1872644554619 4 5585267874665 1 3 1707661502193 1 786925...
result:
ok Correct (49 tests)
Test #15:
score: 0
Accepted
time: 2ms
memory: 3540kb
input:
47 6 1 732987 760106 55296 603458 200099 807044 717568 172525 205746 935599 325975 241081 203248 790931 725483 273225 378276 713360 8 2 663284 718822 614642 622493 507005 300860 868961 355383 526171 183993 261395 953387 190587 257474 621590 746342 933104 658434 382862 548657 807301 79174 576656 8015...
output:
1193207179554 5 6336627471128 1 6 2241434330645 1 2 30542757416069 2 3 5 6 7 83381369400 1 24984301717317 2 4 5 7 8 2170245857053 1 2 9681020760609 1 2 3 4 35522725800605 1 2 3 4 5 6 7 12379607136837 2 4 7 1052082860014 1 61868644715 1 4853953193194 1 2 1106819478866 1 5258583975593 2 3 383561891204...
result:
ok Correct (47 tests)
Test #16:
score: 0
Accepted
time: 0ms
memory: 3888kb
input:
44 6 5 900371 902033 232344 113358 864516 934832 891178 483060 436882 204762 208014 501575 870146 910901 337365 856918 954611 616335 3 3 66599 701457 220973 995998 450604 439125 793434 170747 983479 8 5 202292 459000 39696 97255 352240 665458 89245 394075 932702 579562 245226 134722 672736 442538 93...
output:
36667560176046 1 2 3 5 6 7896017432754 1 2 3 22426403803865 2 3 5 6 8 5551622199051 1 2 3 1454362674978 2 5001343394027 1 5 14472075282505 2 3 4 5052740551731 1 2 3 4 4257211298785 2 4 817252599090 1 13580171395470 1 3 4 5 6 18907511696804 1 2 3 5 1863566715667 1 19159953615761 2 3 4 6 1161215768297...
result:
ok Correct (44 tests)
Test #17:
score: 0
Accepted
time: 106ms
memory: 4756kb
input:
14 7 4 16 42 81 92 86 7 38 18 40 67 96 24 63 2 69 2 34 76 87 67 55 3 3 0 26 49 59 75 59 50 19 40 3 1 74 45 63 40 7 82 26 60 10 6 6 96 72 79 49 63 38 19 53 16 2 8 53 59 27 60 96 60 80 35 31 80 49 62 97 15 84 38 94 15 78 59 86 34 82 89 89 32 46 22 27 88 88 56 29 13 58 9 26 85 72 46 14 56 35 25 35 23 3...
output:
182507 2 4 5 7 48185 1 2 3 11470 1 289406 1 2 3 4 5 6 8684294 1 2 3 4 5 6 7 8 10 11 12 13 15 16 17 18 19 20 22 23 24 25 26 27 28 29 31 32 33 34 35 264653 3 6 7 9 5810787 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 495722 1 2 3 4 5 6 7 8 19533 1 14853 1 4809501 1 2 4 5 6 8 9 ...
result:
ok Correct (14 tests)
Test #18:
score: 0
Accepted
time: 100ms
memory: 4640kb
input:
9 23 9 99 87 77 0 13 29 96 12 87 99 3 6 93 74 15 61 64 33 63 57 67 94 42 18 18 67 13 78 6 72 68 15 82 11 97 34 65 64 52 68 44 34 85 53 60 75 48 31 85 65 50 60 12 11 56 81 8 76 73 30 9 7 74 16 98 12 80 7 62 13 13 32 26 29 44 22 72 16 10 75 8 46 14 63 16 11 53 22 29 18 58 91 89 75 61 69 31 83 68 19 12...
output:
1057201 1 3 5 7 8 13 15 17 20 963371 1 2 3 4 5 6 7 8 9 10 11 12 13 19685 9 146494 5 8 9 267229 8 13 28 37 4047069 1 2 3 4 10 12 15 16 17 18 20 21 22 25 27 28 29 30 31 35 6390798 1 2 3 4 5 6 7 8 9 12 14 15 17 18 19 21 22 23 24 25 26 27 28 29 30 31 32 33 2245044 1 3 5 6 7 8 9 14 15 17 18 19 20 21 22 2...
result:
ok Correct (9 tests)
Test #19:
score: 0
Accepted
time: 71ms
memory: 4640kb
input:
10 15 13 25 65 17 41 39 85 87 73 23 64 9 31 9 44 6 75 93 69 40 25 90 0 38 70 76 96 56 81 98 28 84 90 70 100 20 23 35 11 98 21 49 19 27 95 45 37 29 60 52 33 73 12 38 73 44 54 75 82 98 90 92 45 1 47 34 44 20 53 85 62 80 36 60 9 44 85 1 9 17 16 27 4 27 4 83 80 62 89 29 24 0 38 51 10 39 90 37 66 90 36 0...
output:
1602754 1 2 3 4 6 7 8 9 10 11 12 13 15 7448465 1 2 3 4 5 7 8 9 10 13 14 17 18 19 20 21 22 23 24 25 26 27 28 29 32 33 34 35 37 661625 4 5 6 12 21 23 25 117349 1 4 5 1188429 3 4 5 9 11 14 18 20 22 23 564283 5 16 17 18 20 22 10469 1 1541717 7 8 9 12 13 14 15 16 17 19 20 22 23 72123 10 19 324907 1 5 7 1...
result:
ok Correct (10 tests)
Test #20:
score: 0
Accepted
time: 140ms
memory: 5024kb
input:
8 31 1 41 20 23 60 10 74 45 33 37 84 49 13 28 15 21 33 22 38 27 94 79 62 67 88 34 46 10 51 78 73 33 32 3 78 42 47 39 35 100 97 66 27 58 2 43 32 68 11 77 13 96 64 87 68 98 26 63 31 10 50 6 93 96 44 36 43 51 9 50 75 0 63 60 56 21 71 21 92 46 60 12 52 39 23 72 37 94 90 29 28 33 19 1 33 7 11 20 93 22 53...
output:
17901 21 572210 5 7 10 13 17 18 30 408945 2 3 4 5 6 7 624533 1 2 4 5 6 7 8 9 10 11 12 6204696 1 5 6 8 9 10 11 12 13 14 15 20 21 23 25 26 27 28 29 30 31 34 7211325 1 2 3 4 5 6 7 8 11 12 14 15 16 17 18 19 20 21 22 25 26 27 28 29 30 31 32 33 34 35 8785428 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19...
result:
ok Correct (8 tests)
Test #21:
score: 0
Accepted
time: 74ms
memory: 4612kb
input:
10 31 3 89 30 19 1 38 29 3 61 52 83 78 39 56 29 35 47 52 63 70 51 1 58 97 61 59 76 21 54 58 62 71 6 58 33 32 36 42 93 44 51 83 1 100 44 40 44 33 41 79 82 41 4 80 64 52 32 29 48 35 20 21 7 1 86 17 75 92 88 83 54 20 57 3 3 55 33 40 52 43 35 31 32 8 98 61 95 93 56 30 33 32 77 64 24 1 56 26 8 55 70 54 5...
output:
179090 8 23 29 18449 20 2165435 1 2 4 7 8 9 15 16 17 18 19 21 24 3059794 1 3 4 5 7 8 13 16 17 18 19 21 23 29 31 32 418325 3 9 10 14 16 20 869229 1 3 5 6 8 10 11 14 4415464 1 2 3 4 5 7 8 11 12 13 20 21 22 27 28 29 30 31 32 33 25229 1 20033 1 1157293 1 2 3 4 5 6 7 8 9 10 11 12
result:
ok Correct (10 tests)
Test #22:
score: 0
Accepted
time: 218ms
memory: 4952kb
input:
6 40 5 148219 540531 65569 957600 13440 180320 56420 59020 72800 79904 78496 108416 14532 156046 173000 159500 377300 157850 440380 432620 597520 52578 262128 593598 84150 397100 387200 4440 286824 36704 461288 457056 628452 649264 679184 837760 1518 7568 17138 68057 248193 30107 604892 971257 21826...
output:
35256700637930 12 15 17 30 38 78339102099969 13 17 24 25 27 32 35 260611889012469 1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 18 19 20 21 22 24 25 26 27 29 30 31 32 33 35 36 380830524443355 1 4 5 6 7 8 9 11 12 13 15 16 17 18 19 20 21 23 24 25 27 28 29 30 31 32 33 36 37 38 586709595022129 1 2 3 4 5 6 7 8 9 1...
result:
ok Correct (6 tests)
Test #23:
score: 0
Accepted
time: 232ms
memory: 5164kb
input:
6 39 1 66360 21240 15360 862204 351708 621796 613277 196293 141952 683928 637200 95580 393415 580635 602140 47127 26013 58926 858452 799800 119970 566003 56512 656952 203394 300186 311304 71463 29151 51537 390915 220095 473040 113284 240030 31496 85618 234728 443482 448734 165268 146440 884856 82440...
output:
1615772248650 31 269089084274166 1 2 3 4 5 6 9 12 13 15 16 17 18 19 20 21 22 27 28 30 31 32 33 34 548776252125193 2 4 5 6 7 8 9 10 11 13 14 15 16 17 19 20 21 22 24 25 26 27 28 29 30 31 32 33 38 39 40 172369667820229 4 7 9 12 15 24 26 27 28 29 30 34 23477104723901 4 5 13 14 66684179226149 1 2 3 4 5 6...
result:
ok Correct (6 tests)
Test #24:
score: 0
Accepted
time: 241ms
memory: 4872kb
input:
6 39 34 866663 90160 464324 92616 42840 86802 728764 589612 808152 265923 426447 160965 112024 213596 35108 74529 261261 442260 794941 643153 881538 117936 413424 699840 96005 336545 569700 95722 182513 29999 48906 93249 15327 50049 80261 30295 639232 295680 599104 480332 222180 450179 132660 212740...
output:
538735345311582 1 2 3 4 5 6 7 8 9 10 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 33 34 37 38 39 438240520652826 1 2 3 4 5 7 9 10 11 12 14 15 17 18 19 20 21 22 24 26 27 29 30 31 32 33 34 36 192025790044609 4 6 7 8 10 11 13 14 16 18 20 23 26 28 30 32 35 413826905914550 1 2 4 10 11 12 13 1...
result:
ok Correct (6 tests)
Test #25:
score: 0
Accepted
time: 374ms
memory: 4916kb
input:
6 39 21 6188 81627 24388 24064 638448 116560 1750 1725 2295 408079 215759 468780 82427 33221 35862 29408 780231 142445 264373 547589 70804 314840 652120 84320 307280 206080 328992 362228 436756 361132 669497 269831 291282 473984 22540 67620 93101 37523 40506 812410 327430 353460 462561 337194 471207...
output:
361724327420493 4 10 11 14 15 16 17 19 20 21 22 23 24 25 26 27 32 33 36 37 38 305233557897858 1 4 5 6 7 8 9 14 15 16 20 21 25 26 28 29 30 33 35 37 38 39 40 364627214961930 1 2 3 4 5 6 7 9 10 11 12 13 14 15 16 17 18 19 23 24 25 26 27 28 29 30 31 32 33 34 35 486908108192153 2 3 4 5 6 7 8 9 11 12 13 14...
result:
ok Correct (6 tests)
Test #26:
score: 0
Accepted
time: 214ms
memory: 4820kb
input:
6 37 2 62881 71981 3003 37492 1768 49972 96759 50895 7722 496415 698913 75691 532716 137058 778386 318136 55499 193154 83049 12834 42129 762216 132969 462774 46965 66123 7161 453120 349696 484352 234484 560263 836070 518636 194242 916980 418180 19720 557380 73114 27383 129270 528345 407751 564762 23...
output:
6165807115309 22 27 63331613406291 1 2 5 16 19 24 29 31 431707924040472 4 5 6 9 12 13 14 16 19 20 21 23 24 26 27 28 30 31 32 33 34 37 147319102953230 4 7 9 12 20 21 24 27 29 31 32 34 479272770804776 2 3 4 5 6 7 8 9 10 13 14 15 18 21 22 23 24 25 28 30 32 34 35 36 53870372428667 1 2 3 4 5 6 7 8 9 10 1...
result:
ok Correct (6 tests)
Test #27:
score: 0
Accepted
time: 224ms
memory: 4908kb
input:
6 37 28 322341 152622 7923 375235 425929 200788 757068 0 395876 3342 419421 220015 271420 514960 87740 41181 681429 730380 35640 645975 196911 182050 345400 58850 5040 632520 331800 522649 991612 168953 54802 906818 971960 804693 381006 19779 572020 270840 14060 171840 367845 863675 709614 335988 17...
output:
365135385675001 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 21 22 26 27 28 29 31 32 33 34 35 36 37 313509236729813 2 3 5 6 9 10 11 12 13 18 19 20 21 22 23 24 26 27 28 32 33 34 35 36 38 39 21083458618722 5 6 19 35 552844770177050 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 ...
result:
ok Correct (6 tests)
Test #28:
score: 0
Accepted
time: 206ms
memory: 5124kb
input:
5 40 18 26768 917690 894273 27773 917399 893766 437638 527343 672998 438617 526929 672783 188166 828991 668195 188557 828887 668531 925018 329521 255706 925097 329545 255290 38776 193543 465450 39395 192002 465853 42155 809868 299251 42546 809764 299587 575445 372541 820395 575508 372082 820226 7674...
output:
384393511786490 1 2 3 4 5 6 13 14 15 16 21 22 27 28 33 34 37 38 551074233225578 3 4 7 8 11 12 17 18 19 20 21 22 27 28 31 32 33 34 37 38 39 40 203214615117902 7 8 9 10 13 14 17 18 21 22 29 30 17106658392491 11 29 30 1069073225726797 1 2 3 4 5 6 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29...
result:
ok Correct (5 tests)
Test #29:
score: 0
Accepted
time: 202ms
memory: 4848kb
input:
5 40 10 436536 867628 272321 437472 866683 272839 156140 213170 903347 156758 212916 902657 903372 855812 944327 904209 855559 943202 971752 878196 385296 972470 877451 385805 756697 98894 465648 757077 98856 463938 491660 147122 569732 491867 147005 568481 594152 478851 4765 595088 477906 5283 6195...
output:
180147023659829 5 6 7 8 21 22 31 32 35 36 7937413533750 29 30 115300639388313 9 10 11 12 28 37 38 39 40 918482775517886 1 2 3 4 5 6 7 8 11 12 13 14 19 20 23 24 25 26 27 28 29 30 33 34 36 37 38 39 40 207085167033286 9 10 13 14 17 18 19 20 21 22 25 26 31 32
result:
ok Correct (5 tests)
Test #30:
score: 0
Accepted
time: 202ms
memory: 4984kb
input:
5 40 26 549443 714384 330580 549576 714322 330583 264477 472695 501110 264807 472570 501115 392920 858721 618015 393151 858622 617971 637792 266575 876273 638012 266355 876273 178525 855491 427307 178894 855665 427286 504551 202877 443407 504920 203051 443386 726001 222870 303480 726277 222626 30349...
output:
599242612304376 1 2 3 4 5 6 7 8 9 10 15 16 19 20 23 24 25 26 29 30 31 32 33 34 37 38 9548240286563 13 14 26079508029949 21 22 23 24 107885536725811 5 6 11 12 15 16 31 32 995968220925464 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
result:
ok Correct (5 tests)
Test #31:
score: 0
Accepted
time: 204ms
memory: 5164kb
input:
5 40 26 78353 40799 556780 79742 40494 555749 206056 182118 631726 206535 181638 631520 875538 304834 130625 875712 304814 130217 811364 214930 986013 811515 214259 986027 811697 584446 398195 813086 584141 397164 108227 483658 536811 108478 483424 536383 479143 799173 716498 479804 799108 715949 68...
output:
736896309987717 5 6 7 8 9 10 13 14 15 16 17 18 21 22 23 24 27 28 29 30 31 32 35 36 37 38 1335000958681810 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 311915851182686 1 2 12 17 18 19 20 25 26 27 28 29 30 31 32 39 40 331689855752524 3 4 ...
result:
ok Correct (5 tests)
Test #32:
score: 0
Accepted
time: 199ms
memory: 5168kb
input:
5 40 2 887521 112430 471928 888041 112222 470628 949786 607419 678102 950007 607298 678152 244838 25667 933036 244960 25607 932794 831257 967716 122091 831378 967085 121930 613563 346390 854423 613718 346374 854407 554101 342462 90389 554223 342402 90147 607109 594828 461354 607927 594449 461488 975...
output:
8785559414052 23 24 7748601505808 13 14 303241748516371 5 6 9 10 15 16 25 26 27 28 31 32 37 38 39 40 116783806801470 1 2 11 12 35 36 39 40 591315123929165 1 2 5 6 7 8 9 10 13 14 19 20 21 22 23 24 25 26 31 32 35 36 38 39 40
result:
ok Correct (5 tests)
Test #33:
score: 0
Accepted
time: 203ms
memory: 4952kb
input:
5 40 31 945743 426668 268172 946321 426442 267544 144551 332600 203494 145265 332108 203002 965954 678123 116631 966668 677631 116139 138898 742824 275829 139561 741678 276291 985084 280714 248322 985900 279721 248334 42112 197804 983027 43200 196882 982507 135362 709874 221072 136076 709382 220580 ...
output:
899056785411477 1 2 5 6 7 8 9 10 11 12 13 14 15 16 19 20 21 22 25 26 29 30 31 33 34 35 36 37 38 39 40 665740501663585 3 4 9 10 13 14 15 16 17 18 20 25 26 27 28 29 30 31 32 33 34 35 36 75942686883976 5 6 7 8 17 18 996606730147706 2 3 4 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 ...
result:
ok Correct (5 tests)
Test #34:
score: 0
Accepted
time: 200ms
memory: 4980kb
input:
5 40 23 142909 30189 633838 143743 30015 633808 636751 29861 373832 637984 29627 373598 419997 214730 133589 420957 214538 133541 307551 370010 479055 307743 369476 479005 285983 845247 521185 286787 845187 520981 551982 339674 903008 552204 339752 902798 605153 967888 94108 605493 966500 94232 1763...
output:
561422724990616 7 9 10 11 12 13 14 21 22 23 24 27 28 29 30 31 32 33 34 35 36 39 40 221232955961857 1 2 3 4 9 10 11 12 24 25 26 31 32 48199542877499 7 8 11 12 23 24 187903002535061 1 2 10 25 26 27 28 31 32 37 38 330193388981854 7 8 9 10 13 14 21 22 23 24 27 28 33 34 35 36
result:
ok Correct (5 tests)
Test #35:
score: 0
Accepted
time: 24ms
memory: 3652kb
input:
3 39 26 1733 0 0 1733 0 0 1733 0 0 1733 0 0 1733 0 0 1733 0 0 1733 0 0 1733 0 0 1733 0 0 1733 0 0 1733 0 0 1733 0 0 1733 0 0 0 0 1733 0 0 1733 0 0 1733 0 0 1733 0 0 1733 0 0 1733 0 0 1733 0 0 1733 0 0 1733 0 0 1733 0 0 1733 0 0 1733 0 0 1733 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 100...
output:
1600309841 1 2 3 4 5 6 7 8 9 10 11 12 13 27 28 29 30 31 32 33 34 35 36 37 38 39 1600309841 1 2 3 4 5 6 7 8 9 10 11 12 13 27 28 29 30 31 32 33 34 35 36 37 38 39 1600309841 1 2 3 4 5 6 7 8 9 10 11 12 13 27 28 29 30 31 32 33 34 35 36 37 38 39
result:
ok Correct (3 tests)
Test #36:
score: 0
Accepted
time: 243ms
memory: 4956kb
input:
5 40 20 771311 437271 462462 104654 948670 298449 576822 212756 788676 134130 300835 944196 271991 949568 156015 448286 382547 807896 328015 139095 934375 543905 681818 489173 245870 516775 820055 417715 538598 731728 383183 376923 843267 50334 108202 992853 92812 211164 973034 906492 309404 287298 ...
output:
380536840864110 4 6 7 9 11 12 13 17 25 27 28 29 31 33 34 35 36 37 39 40 383253213169953 1 2 5 6 7 9 10 11 12 14 15 17 20 22 25 28 32 36 37 40 371706494448254 1 3 4 7 10 11 12 13 16 17 20 23 24 27 31 33 34 35 38 40 367179106546779 1 4 5 6 7 10 11 14 15 18 20 21 22 24 25 27 28 34 35 36 377343927481110...
result:
ok Correct (5 tests)
Test #37:
score: 0
Accepted
time: 14ms
memory: 3784kb
input:
5 20 1 981495 981495 981495 981271 981757 981455 981294 981326 981862 981534 981305 981644 981707 981360 981416 981564 981625 981293 981569 981468 981445 981146 981653 981684 981518 981514 981451 981446 981530 981506 981468 981629 981386 981628 981435 981420 981488 981676 981319 981482 981455 981546...
output:
2889997305075 1 2889997305075 18 2889997305075 13 2889997305075 19 2889997305075 11
result:
ok Correct (5 tests)
Test #38:
score: 0
Accepted
time: 789ms
memory: 4200kb
input:
3 30 15 981150 982279 981053 982064 980460 981958 981855 981577 981050 981283 981717 981483 981694 980885 981904 981386 982318 980778 981495 981495 981495 981472 981464 981547 981334 981750 981399 981881 981935 980666 980943 981836 981704 981688 981304 981491 981851 981293 981339 981085 982311 98108...
output:
650248593397441 5 7 8 9 12 13 17 18 19 21 22 23 27 28 30 650248604086850 3 4 5 6 8 9 15 16 18 20 22 24 26 28 29 650248578959853 1 3 5 7 8 9 10 11 12 14 16 17 21 27 28
result:
ok Correct (3 tests)
Test #39:
score: 0
Accepted
time: 315ms
memory: 5188kb
input:
2 40 1 981946 980966 981571 980734 981697 982052 981646 981775 981061 980455 982022 982005 981249 981863 981371 981770 981325 981388 980679 981488 982316 980975 981824 981684 981018 981373 982092 981958 981046 981479 982011 980531 981940 980671 981858 981954 982084 980687 981712 981393 981657 981433...
output:
2889997305075 36 2889997305075 36
result:
ok Correct (2 tests)
Test #40:
score: 0
Accepted
time: 3627ms
memory: 4948kb
input:
2 40 5 981946 980966 981571 980734 981697 982052 981646 981775 981061 980455 982022 982005 981249 981863 981371 981770 981325 981388 980679 981488 982316 980975 981824 981684 981018 981373 982092 981958 981046 981479 982011 980531 981940 980671 981858 981954 982084 980687 981712 981393 981657 981433...
output:
72249869404917 2 7 12 20 36 72249874044580 7 21 32 36 38
result:
ok Correct (2 tests)
Test #41:
score: -100
Time Limit Exceeded
input:
2 40 10 981348 981298 981836 982420 980720 981342 980990 981342 982151 981933 981865 980685 982075 981531 980876 981628 982271 980583 980907 981500 982075 981817 980479 982186 981786 981355 981342 980914 982428 981140 981330 982035 981117 981684 980896 981903 980480 981955 982048 981849 980806 98182...