#73

by asd

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


#1

0ms / 6916KB / Accepted
Input
4
7 9 1 5
9 8 4 3
Output
17
5
Answer
17
5
Checker Information
^ ^Your answer is right!

#2

15ms / 6920KB / Accepted
Input
4
0 7 1 6
1 5 0 6
Output
2
8
Answer
2
8
Checker Information
^ ^Your answer is right!

#3

15ms / 6916KB / Accepted
Input
5
9 6 3 0 3
10 8 6 10 9
Output
19
11
Answer
19
11
Checker Information
^ ^Your answer is right!

#4

0ms / 6916KB / Accepted
Input
5
10 7 1 9 1
8 5 3 9 1
Output
2
23
Answer
3
22
Checker Information
^ ^Your answer is right

#5

15ms / 6920KB / Accepted
Input
5
2 9 10 2 9
3 9 7 5 9
Output
3
27
Answer
3
27
Checker Information
^ ^Your answer is right!

#6

30ms / 6916KB / Accepted
Input
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
Output
138
12
Answer
138
12
Checker Information
^ ^Your answer is right!

#7

15ms / 6916KB / Accepted
Input
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
Output
2
131
Answer
2
131
Checker Information
^ ^Your answer is right!

#8

30ms / 6916KB / Accepted
Input
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
Output
3
153
Answer
3
153
Checker Information
^ ^Your answer is right!

#9

30ms / 6916KB / Accepted
Input
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
Output
439
1
Answer
439
1
Checker Information
^ ^Your answer is right!

#10

31ms / 6916KB / Accepted
Input
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
Output
137
42
Answer
137
42
Checker Information
^ ^Your answer is right!

#11

0ms / 6916KB / Accepted
Input
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
Output
262
5
Answer
262
5
Checker Information
^ ^Your answer is right!

#12

0ms / 6916KB / Accepted
Input
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
Output
3
325
Answer
3
325
Checker Information
^ ^Your answer is right!

#13

15ms / 6916KB / Accepted
Input
8
664 195 357 238 778 150 553 444
674 574 367 783 197 349 645 216
Output
3230
1
Answer
3230
1
Checker Information
^ ^Your answer is right!

#14

15ms / 6920KB / Accepted
Input
6
1626 1834 1725 910 569 491
0 0 1902 0 558 0
Output
5431
559
Answer
5431
559
Checker Information
^ ^Your answer is right!

#15

15ms / 6916KB / Accepted
Input
6
953 333 513 1210 919 831
499 117 1341 1668 965 1571
Output
4247
118
Answer
4247
118
Checker Information
^ ^Your answer is right!

#16

0ms / 6920KB / Accepted
Input
6
196 624 129 706 907 806
40 549 401 487 761 984
Output
197
2782
Answer
197
2782
Checker Information
^ ^Your answer is right!

#17

0ms / 6916KB / Accepted
Input
7
6407 1988 8778 372 4672 5036 4439
5676 7798 6944 4770 9801 6601 5061
Output
31321
1
Answer
31321
1
Checker Information
^ ^Your answer is right!

#18

0ms / 6920KB / Accepted
Input
7
14144 2398 2776 8766 12825 0 0
6672 3497 7707 11356 0 0 0
Output
15224
22561
Answer
15224
22561
Checker Information
^ ^Your answer is right!

#19

15ms / 6920KB / Accepted
Input
7
6737 9780 7081 2980 4471 1108 7340
5295 6925 8573 2633 9497 2738 8474
Output
35410
2739
Answer
35410
2739
Checker Information
^ ^Your answer is right!

#20

0ms / 6920KB / Accepted
Input
10
115858 252660 148193 363373 452482 490432 253318 292169 408378 44096
383025 238007 210944 272968 311011 48352 151545 137672 451871 206921
Output
1
2363965
Answer
1
2363965
Checker Information
^ ^Your answer is right!

#21

31ms / 6920KB / Accepted
Input
10
42878 2130 0 0 0 0 14152 0 0 15604
83638 42181 0 0 2864 95974 0 0 0 69599
Output
72635
98839
Answer
72635
98839
Checker Information
^ ^Your answer is right!

#22

0ms / 6916KB / Accepted
Input
10
2157 33517 21290 78223 56927 61222 52597 1383 91906 64469
11505 59405 56999 21757 15111 19548 21555 75762 73940 75835
Output
2158
416307
Answer
2158
416307
Checker Information
^ ^Your answer is right!

#23

30ms / 6916KB / Accepted
Input
10
39104 3501 77521 61780 57128 46264 4659 58242 44526 49394
33763 27384 78326 87680 48538 51401 8877 17557 48524 49434
Output
399515
36262
Answer
399515
36262
Checker Information
^ ^Your answer is right!

#24

15ms / 6916KB / Accepted
Input
10
2097152 262144 16777216 8388608 524288 33554432 131072 1048576 67108864 4194304
16777216 4194304 262144 131072 8388608 67108864 33554432 1048576 524288 2097152
Output
1
133955585
Answer
133955585
1
Checker Information
^ ^Your answer is right

#25

15ms / 6920KB / Accepted
Input
10
99550280 0 37190205 0 0 58887845 0 6945904 0 78261539
0 12724296 62033720 0 0 0 0 0 59898447 52286412
Output
165384030
134656464
Answer
165384030
134656464
Checker Information
^ ^Your answer is right!

#26

15ms / 6920KB / Accepted
Input
10
29721690 24799470 7837927 43378125 15330231 27732505 94009387 1238995 35362545 27086308
54204017 19688448 54874871 12236260 75483667 80775517 52571155 3714409 72917126 85936173
Output
298659257
3714410
Answer
298659257
3714410
Checker Information
^ ^Your answer is right!

#27

15ms / 6912KB / Accepted
Input
10
7748481 56609221 79407390 4849068 81324947 77461486 64823081 59142970 9976526 25475828
61095572 34817652 57667637 28205946 46904393 28610160 56633474 51223724 1792238 64626774
Output
9976527
402967411
Answer
9976527
402967411
Checker Information
^ ^Your answer is right!

#28

46ms / 6916KB / Accepted
Input
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
Output
1
262143
Answer
262143
1
Checker Information
^ ^Your answer is right

#29

92ms / 6920KB / Accepted
Input
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
Output
1113706
4675
Answer
1113706
4675
Checker Information
^ ^Your answer is right!

#30

61ms / 6916KB / Accepted
Input
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
Output
11274
1106890
Answer
11274
1106890
Checker Information
^ ^Your answer is right!

#31

218ms / 13952KB / Accepted
Input
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
Output
220451
1
Answer
220451
1
Checker Information
^ ^Your answer is right!

#32

249ms / 13956KB / Accepted
Input
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
Output
1653
170169
Answer
1653
170169
Checker Information
^ ^Your answer is right!

#33

171ms / 13952KB / Accepted
Input
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
Output
164729
2239
Answer
164729
2239
Checker Information
^ ^Your answer is right!

#34

218ms / 13956KB / Accepted
Input
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
Output
456182
1
Answer
456182
1
Checker Information
^ ^Your answer is right!

#35

249ms / 13952KB / Accepted
Input
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
Output
484605
3697
Answer
484605
3697
Checker Information
^ ^Your answer is right!

#36

218ms / 13952KB / Accepted
Input
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
Output
3319
492249
Answer
3319
492249
Checker Information
^ ^Your answer is right!

#37

0ms / 6912KB / Accepted
Input
4
4 0 6 5
4 5 1 0
Output
6
10
Answer
6
10
Checker Information
^ ^Your answer is right!

#38

15ms / 6916KB / Accepted
Input
4
3 10 5 5
1 9 6 9
Output
19
2
Answer
19
2
Checker Information
^ ^Your answer is right!

#39

15ms / 6920KB / Accepted
Input
4
1 3 8 4
1 1 4 9
Output
13
2
Answer
13
2
Checker Information
^ ^Your answer is right!

#40

0ms / 6920KB / Accepted
Input
4
1 7 1 3
4 7 3 3
Output
12
1
Answer
12
1
Checker Information
^ ^Your answer is right!

#41

202ms / 13952KB / Accepted
Input
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<...>
Output
1132134045
1
Answer
1132134045
1
Checker Information
^ ^Your answer is right!

#42

156ms / 13956KB / Accepted
Input
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<...>
Output
907782396
2683489
Answer
907782396
2683489
Checker Information
^ ^Your answer is right!

#43

218ms / 13956KB / Accepted
Input
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<...>
Output
10917818
889203133
Answer
10917818
889203133
Checker Information
^ ^Your answer is right!

#44

249ms / 13952KB / Accepted
Input
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<...>
Output
823945690
1
Answer
823945690
1
Checker Information
^ ^Your answer is right!

#45

187ms / 13948KB / Accepted
Input
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<...>
Output
819615765
1556398
Answer
819615765
1556398
Checker Information
^ ^Your answer is right!

#46

202ms / 13948KB / Accepted
Input
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<...>
Output
840918775
7684399
Answer
840918775
7684399
Checker Information
^ ^Your answer is right!

#47

187ms / 13952KB / Accepted
Input
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<...>
Output
1
806429472
Answer
1
806429472
Checker Information
^ ^Your answer is right!

#48

217ms / 13952KB / Accepted
Input
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<...>
Output
707550830
1853667
Answer
707550830
1853667
Checker Information
^ ^Your answer is right!

#49

202ms / 13952KB / Accepted
Input
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<...>
Output
944571978
7698163
Answer
944571978
7698163
Checker Information
^ ^Your answer is right!

#50

15ms / 6920KB / Accepted
Input
4
9 8 0 1
7 7 4 9
Output
1
21
Answer
1
21
Checker Information
^ ^Your answer is right!

#51

15ms / 6920KB / Accepted
Input
4
5 1 8 6
5 2 7 6
Output
2
16
Answer
2
16
Checker Information
^ ^Your answer is right!

#52

0ms / 6920KB / Accepted
Input
4
8 9 2 4
8 7 5 1
Output
5
16
Answer
5
16
Checker Information
^ ^Your answer is right!

#53

15ms / 6920KB / Accepted
Input
5
1 1 1 0 0
0 1 0 1 0
Output
3
2
Answer
3
2
Checker Information
^ ^Your answer is right!

#54

0ms / 6916KB / Accepted
Input
4
0 8 9 0
5 9 6 4
Output
1
19
Answer
10
10
Checker Information
^ ^Your answer is right

#55

0ms / 6916KB / Accepted
Input
4
10 7 6 4
9 8 9 1
Output
22
2
Answer
22
2
Checker Information
^ ^Your answer is right!

#56

0ms / 6916KB / Accepted
Input
4
8 7 1 8
10 2 6 9
Output
17
7
Answer
17
7
Checker Information
^ ^Your answer is right!

#57

31ms / 6916KB / Accepted
Input
7
58 4 14 9 49 96 49
39 88 54 95 54 12 13
Output
276
1
Answer
276
1
Checker Information
^ ^Your answer is right!

#58

15ms / 6916KB / Accepted
Input
4
8 3 10 2
3 2 0 3
Output
11
7
Answer
11
7
Checker Information
^ ^Your answer is right!

#59

15ms / 6916KB / Accepted
Input
4
2 9 6 3
6 5 6 1
Output
4
14
Answer
4
14
Checker Information
^ ^Your answer is right!

#60

0ms / 6920KB / Accepted
Input
4
5 6 6 2
2 10 4 3
Output
14
4
Answer
14
4
Checker Information
^ ^Your answer is right!

#61

15ms / 6916KB / Accepted
Input
10
1024 1024 1024 1024 1024 1024 1024 1024 1024 1024
123 123 123 123 123 123 123 123 123 123
Output
1
1108
Answer
1
1108
Checker Information
^ ^Your answer is right!

#62

15ms / 6916KB / Accepted
Input
4
7 0 1 1
4 10 10 4
Output
9
11
Answer
9
11
Checker Information
^ ^Your answer is right!

#63

15ms / 6916KB / Accepted
Input
4
9 1 7 7
7 4 6 10
Output
18
5
Answer
18
5
Checker Information
^ ^Your answer is right!

#64

15ms / 6916KB / Accepted
Input
4
1 1 10 6
3 1 7 4
Output
2
12
Answer
2
12
Checker Information
^ ^Your answer is right!

#65

140ms / 13952KB / Accepted
Input
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<...>
Output
1
1900000001
Answer
1900000001
1
Checker Information
^ ^Your answer is right

#66

0ms / 6920KB / Accepted
Input
4
10 3 4 5
0 1 3 5
Output
11
9
Answer
11
9
Checker Information
^ ^Your answer is right!

#67

15ms / 6920KB / Accepted
Input
4
10 9 4 1
10 9 6 1
Output
2
21
Answer
21
2
Checker Information
^ ^Your answer is right

#68

15ms / 6920KB / Accepted
Input
4
9 8 1 10
10 6 7 10
Output
20
8
Answer
20
8
Checker Information
^ ^Your answer is right!

#69

31ms / 6916KB / Accepted
Input
4
9 7 5 7
0 7 5 8
Output
24
1
Answer
24
1
Checker Information
^ ^Your answer is right!

#70

0ms / 6916KB / Accepted
Input
4
5 5 2 7
9 5 2 3
Output
15
3
Answer
15
3
Checker Information
^ ^Your answer is right!

#71

31ms / 6916KB / Accepted
Input
4
6 1 7 1
6 2 6 4
Output
2
13
Answer
2
13
Checker Information
^ ^Your answer is right!

#72

31ms / 6916KB / Accepted
Input
4
0 5 10 5
7 0 2 6
Output
6
14
Answer
6
14
Checker Information
^ ^Your answer is right!

#73

15ms / 6916KB / Accepted
Input
4
8 9 4 1
5 10 4 1
Output
2
17
Answer
2
17
Checker Information
^ ^Your answer is right!

#74

15ms / 6916KB / Accepted
Input
4
2 2 10 5
2 3 5 8
Output
3
14
Answer
3
14
Checker Information
^ ^Your answer is right!

#75

15ms / 6916KB / Accepted
Input
4
0 3 6 2
8 6 4 2
Output
10
9
Answer
10
9
Checker Information
^ ^Your answer is right!

#76

15ms / 6916KB / Accepted
Input
4
1 7 3 7
1 6 10 8
Output
16
2
Answer
16
2
Checker Information
^ ^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;
}