Submitted 4 years 9 months 1 day ago
Tue Feb 04 20:28:39 CST 2020
Judger: ZJS
Dataset Version: v0
249 ms /
13956 KB
Final
100
Problem: lss2.glove2
Language: GNU C++ 11
4 7 9 1 5 9 8 4 3
17 5
17 5
^ ^Your answer is right!
4 0 7 1 6 1 5 0 6
2 8
2 8
^ ^Your answer is right!
5 9 6 3 0 3 10 8 6 10 9
19 11
19 11
^ ^Your answer is right!
5 10 7 1 9 1 8 5 3 9 1
2 23
3 22
^ ^Your answer is right
5 2 9 10 2 9 3 9 7 5 9
3 27
3 27
^ ^Your answer is right!
15 3 19 15 9 15 9 0 20 4 5 5 14 4 4 14 20 10 15 16 9 16 11 13 18 16 18 1 16 4 19
138 12
138 12
^ ^Your answer is right!
15 8 3 17 1 14 14 5 17 12 9 12 1 13 17 15 17 9 4 10 14 6 3 6 9 17 4 1 4 11 18
2 131
2 131
^ ^Your answer is right!
15 18 19 2 10 11 12 18 12 20 20 5 3 16 8 2 6 12 5 15 17 20 13 6 12 8 8 7 18 10 1
3 153
3 153
^ ^Your answer is right!
14 20 41 16 4 6 27 62 27 2 36 75 53 5 66 10 53 42 47 77 15 49 22 34 8 67 17 13 61
439 1
439 1
^ ^Your answer is right!
13 0 0 14 37 0 25 21 0 14 25 48 0 0 14 0 0 0 0 3 0 0 0 0 37 24 0
137 42
137 42
^ ^Your answer is right!
13 8 20 29 28 25 44 10 8 9 1 29 22 36 34 39 30 23 43 6 39 14 39 4 19 42 35
262 5
262 5
^ ^Your answer is right!
13 44 43 30 45 44 50 34 29 29 43 1 2 24 15 30 47 47 10 22 28 37 9 33 5 6 44
3 325
3 325
^ ^Your answer is right!
8 664 195 357 238 778 150 553 444 674 574 367 783 197 349 645 216
3230 1
3230 1
^ ^Your answer is right!
6 1626 1834 1725 910 569 491 0 0 1902 0 558 0
5431 559
5431 559
^ ^Your answer is right!
6 953 333 513 1210 919 831 499 117 1341 1668 965 1571
4247 118
4247 118
^ ^Your answer is right!
6 196 624 129 706 907 806 40 549 401 487 761 984
197 2782
197 2782
^ ^Your answer is right!
7 6407 1988 8778 372 4672 5036 4439 5676 7798 6944 4770 9801 6601 5061
31321 1
31321 1
^ ^Your answer is right!
7 14144 2398 2776 8766 12825 0 0 6672 3497 7707 11356 0 0 0
15224 22561
15224 22561
^ ^Your answer is right!
7 6737 9780 7081 2980 4471 1108 7340 5295 6925 8573 2633 9497 2738 8474
35410 2739
35410 2739
^ ^Your answer is right!
10 115858 252660 148193 363373 452482 490432 253318 292169 408378 44096 383025 238007 210944 272968 311011 48352 151545 137672 451871 206921
1 2363965
1 2363965
^ ^Your answer is right!
10 42878 2130 0 0 0 0 14152 0 0 15604 83638 42181 0 0 2864 95974 0 0 0 69599
72635 98839
72635 98839
^ ^Your answer is right!
10 2157 33517 21290 78223 56927 61222 52597 1383 91906 64469 11505 59405 56999 21757 15111 19548 21555 75762 73940 75835
2158 416307
2158 416307
^ ^Your answer is right!
10 39104 3501 77521 61780 57128 46264 4659 58242 44526 49394 33763 27384 78326 87680 48538 51401 8877 17557 48524 49434
399515 36262
399515 36262
^ ^Your answer is right!
10 2097152 262144 16777216 8388608 524288 33554432 131072 1048576 67108864 4194304 16777216 4194304 262144 131072 8388608 67108864 33554432 1048576 524288 2097152
1 133955585
133955585 1
^ ^Your answer is right
10 99550280 0 37190205 0 0 58887845 0 6945904 0 78261539 0 12724296 62033720 0 0 0 0 0 59898447 52286412
165384030 134656464
165384030 134656464
^ ^Your answer is right!
10 29721690 24799470 7837927 43378125 15330231 27732505 94009387 1238995 35362545 27086308 54204017 19688448 54874871 12236260 75483667 80775517 52571155 3714409 72917126 85936173
298659257 3714410
298659257 3714410
^ ^Your answer is right!
10 7748481 56609221 79407390 4849068 81324947 77461486 64823081 59142970 9976526 25475828 61095572 34817652 57667637 28205946 46904393 28610160 56633474 51223724 1792238 64626774
9976527 402967411
9976527 402967411
^ ^Your answer is right!
18 64 2048 128 4 65536 131072 8 2 512 256 4096 32768 1 8192 16384 16 1024 32 256 65536 2048 16 8192 32 1 4096 512 128 1024 64 8 2 4 131072 16384 32768
1 262143
262143 1
^ ^Your answer is right
18 8884 35047 98532 19923 58681 33309 86706 68055 39319 17317 50138 114600 75632 88946 30073 104303 81013 120544 4674 98768 76053 110881 73330 120579 57117 52041 92625 38716 63891 27409 109334 72775 62456 64217 79049 107488
1113706 4675
1113706 4675
^ ^Your answer is right!
18 79988 7216 126747 112583 25868 104413 90016 106460 121592 16292 101172 95788 18364 22232 11273 79790 22038 2193 96074 19559 56880 62456 72378 46563 68731 39671 107742 67248 19238 125591 80313 99226 2807 77059 68160 15026
11274 1106890
11274 1106890
^ ^Your answer is right!
20 6628 4988 4471 18405 9919 817 17707 2756 9026 19556 10622 13926 10316 9887 10428 19201 7230 16075 19101 10208 14970 19576 15068 8767 3525 10167 7701 15489 8889 6746 1708 19238 15456 6179 17642 9095 10717 15349 11852 19744
220451 1
220451 1
^ ^Your answer is right!
20 4432 12766 11355 8326 2247 765 9581 19128 18713 2950 1652 9849 16982 9883 9532 18861 6830 13454 2549 16303 13020 16787 14790 5316 8502 7167 9770 4830 5805 14615 929 6589 3733 8635 11266 5979 9399 17199 5106 4464
1653 170169
1653 170169
^ ^Your answer is right!
20 3259 8331 4533 2947 7231 156 3399 19670 2717 9231 16116 7138 2403 10885 7986 16787 5882 8832 10712 19072 6315 18785 10769 11752 14579 2238 4737 18686 10196 12894 6419 9807 1224 10952 12753 8454 7459 12503 4476 6527
164729 2239
164729 2239
^ ^Your answer is right!
20 27839 14178 17745 6654 14018 18015 1277 31991 25225 47042 9497 20565 45420 45323 4520 19680 46032 42179 18954 1304 42587 15413 38472 22399 49144 28291 46841 23517 15650 16531 30398 43489 40010 7443 9444 4027 34760 20022 45319 9984
456182 1
456182 1
^ ^Your answer is right!
20 32254 20936 206 40815 5904 33996 25851 22054 28044 6857 11635 20484 42528 44628 25308 26131 31636 8241 17053 45947 20434 18066 3696 30198 17499 1218 20885 23517 32411 22280 20952 31016 43216 21157 21831 49119 21505 47681 21173 49548
484605 3697
484605 3697
^ ^Your answer is right!
20 920 17805 48712 19780 1942 47724 9808 33421 1376 49389 39584 45553 20611 44566 36800 29930 26537 28358 18714 36183 5364 37896 40307 49218 1556 22651 29451 31434 3188 6336 44236 20460 40492 42947 40239 8785 7022 16398 42206 8398
3319 492249
3319 492249
^ ^Your answer is right!
4 4 0 6 5 4 5 1 0
6 10
6 10
^ ^Your answer is right!
4 3 10 5 5 1 9 6 9
19 2
19 2
^ ^Your answer is right!
4 1 3 8 4 1 1 4 9
13 2
13 2
^ ^Your answer is right!
4 1 7 1 3 4 7 3 3
12 1
12 1
^ ^Your answer is right!
20 77496734 95442179 68007672 84183656 78992848 42229574 47589410 86783867 90354545 27097468 78966107 53841419 4761209 16140415 50892201 25613748 14202938 41059778 94053717 59185768 39642904 27034218 89626345 81513759 62724768 95377155 99200009 8100041 905<...>
1132134045 1
1132134045 1
^ ^Your answer is right!
20 49625298 305329 77627806 47307552 48636881 91595214 89674638 36807884 12393775 81234874 73358437 35673586 22091754 25508654 38295923 21217168 36567351 37407729 47141145 47705172 15038844 2683488 72339548 91131244 75749918 90509863 86789376 71260953 4359<...>
907782396 2683489
907782396 2683489
^ ^Your answer is right!
20 86328567 67038725 30675853 15553732 65218055 78631428 9980754 39165045 81879841 3615219 16757284 33114316 68736697 21434549 89756922 88428898 10917817 95425366 2316835 2493120 43554864 77642873 31238302 68153876 49201045 56848432 40519051 19499158 26591<...>
10917818 889203133
10917818 889203133
^ ^Your answer is right!
20 6263245 32431689 488431 30017759 73576174 48155167 65326067 29781374 97581499 58910185 82452998 26927246 30475516 30219094 83694023 16695986 18997048 38815776 37681404 15943439 43791231 59538694 55578780 93618940 95054570 21086625 64842677 15634944 5666<...>
823945690 1
823945690 1
^ ^Your answer is right!
20 83140627 54566407 48599958 29980331 40990361 85620779 11380086 86879819 43317506 7104921 14129446 71686667 50297778 68723586 4767455 39468834 6496457 23779729 17928982 37252492 31776344 75234207 95108630 29928833 13362607 35730396 78263643 96045534 8340<...>
819615765 1556398
819615765 1556398
^ ^Your answer is right!
20 38000857 11975406 91583040 57546992 34600082 68263859 29242490 15814487 861456 93896984 41517734 22165157 38671149 15333100 78271703 57943619 31185439 22535965 28654462 75691655 75817852 4104851 82997222 70906408 4925411 97388658 8759887 12213821 768439<...>
840918775 7684399
840918775 7684399
^ ^Your answer is right!
20 65668052 42264279 66566365 64012760 41034201 65509715 35810215 39491807 38030762 33535466 63823204 62867721 57142388 61426208 34940739 27804894 32199246 32963489 50498014 28539108 30599436 20124044 24047534 54006503 15383912 44819418 24282613 36193360 1<...>
1 806429472
1 806429472
^ ^Your answer is right!
20 16615873 5650681 8195681 2728806 32005968 59844529 19176897 77646428 56474205 74201483 40735138 45957007 21179474 56468026 17346321 88015647 26195242 23672292 33272848 7818964 74610357 16966776 59263433 1853666 10912898 98961803 68486363 74573855 961908<...>
707550830 1853667
707550830 1853667
^ ^Your answer is right!
20 48931212 88528765 53005794 56731296 91116035 16543654 80790926 13393322 48717529 23397298 74257375 36047813 64084541 71546469 12421302 5403474 76888940 45599197 31209737 19350620 60603344 76320927 51520281 13500657 94199765 45484097 72279788 34247701 42<...>
944571978 7698163
944571978 7698163
^ ^Your answer is right!
4 9 8 0 1 7 7 4 9
1 21
1 21
^ ^Your answer is right!
4 5 1 8 6 5 2 7 6
2 16
2 16
^ ^Your answer is right!
4 8 9 2 4 8 7 5 1
5 16
5 16
^ ^Your answer is right!
5 1 1 1 0 0 0 1 0 1 0
3 2
3 2
^ ^Your answer is right!
4 0 8 9 0 5 9 6 4
1 19
10 10
^ ^Your answer is right
4 10 7 6 4 9 8 9 1
22 2
22 2
^ ^Your answer is right!
4 8 7 1 8 10 2 6 9
17 7
17 7
^ ^Your answer is right!
7 58 4 14 9 49 96 49 39 88 54 95 54 12 13
276 1
276 1
^ ^Your answer is right!
4 8 3 10 2 3 2 0 3
11 7
11 7
^ ^Your answer is right!
4 2 9 6 3 6 5 6 1
4 14
4 14
^ ^Your answer is right!
4 5 6 6 2 2 10 4 3
14 4
14 4
^ ^Your answer is right!
10 1024 1024 1024 1024 1024 1024 1024 1024 1024 1024 123 123 123 123 123 123 123 123 123 123
1 1108
1 1108
^ ^Your answer is right!
4 7 0 1 1 4 10 10 4
9 11
9 11
^ ^Your answer is right!
4 9 1 7 7 7 4 6 10
18 5
18 5
^ ^Your answer is right!
4 1 1 10 6 3 1 7 4
2 12
2 12
^ ^Your answer is right!
20 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100<...>
1 1900000001
1900000001 1
^ ^Your answer is right
4 10 3 4 5 0 1 3 5
11 9
11 9
^ ^Your answer is right!
4 10 9 4 1 10 9 6 1
2 21
21 2
^ ^Your answer is right
4 9 8 1 10 10 6 7 10
20 8
20 8
^ ^Your answer is right!
4 9 7 5 7 0 7 5 8
24 1
24 1
^ ^Your answer is right!
4 5 5 2 7 9 5 2 3
15 3
15 3
^ ^Your answer is right!
4 6 1 7 1 6 2 6 4
2 13
2 13
^ ^Your answer is right!
4 0 5 10 5 7 0 2 6
6 14
6 14
^ ^Your answer is right!
4 8 9 4 1 5 10 4 1
2 17
2 17
^ ^Your answer is right!
4 2 2 10 5 2 3 5 8
3 14
3 14
^ ^Your answer is right!
4 0 3 6 2 8 6 4 2
10 9
10 9
^ ^Your answer is right!
4 1 7 3 7 1 6 10 8
16 2
16 2
^ ^Your answer is right!
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <deque>
#include <bits/stdc++.h>
//#include "testlib.h"
using namespace std;
#define ll long long
#define pii pair<int, int>
#define qi ios::sync_with_stdio(0)
bool debug = true;
/* *************************************
* Written in New Computer *
* The following code belongs to *
* XiaoGeNintendo of HellHoleStudios *
*************************************
*/
template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2> ptt) {
os << ptt.first << "," << ptt.second;
return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vt) {
os << "{";
for (int i = 0; i < vt.size(); i++) {
os << vt[i] << " ";
}
os << "}";
return os;
}
int n;
int a[25], b[25];
int mx[1 << 21];
int smA, smB;
int main(int argc, char* argv[]) {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
smA += a[i];
}
for (int i = 0; i < n; i++) {
cin >> b[i];
smB += b[i];
}
vector<pii> v;
for (int i = 0; i < (1 << n); i++) {
int x = 0, y = 0;
for (int j = 0; j < n; j++) {
if (i & (1 << j)) {
x += a[j];
} else {
y += b[j];
}
}
v.push_back(make_pair(x, y));
}
sort(v.begin(), v.end());
// cout<<v<<endl;
mx[v.size() - 1] = v.back().second;
for (int i = v.size() - 2; i >= 0; i--) {
mx[i] = max(mx[i + 1], v[i].second);
}
int mA = 1e9, mB = 1e9;
for (int i = 0; i < v.size(); i++) {
int A = v[i].first + 1;
int B = mx[i + 1] + 1;
if (A > smA || B > smB) {
continue;
}
if (A + B < mA + mB) {
mA = A;
mB = B;
}
}
cout << mA << endl << mB;
return 0;
}