QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#56479 | #2554. AND PLUS OR | mendicillin2# | AC ✓ | 320ms | 7748kb | C++17 | 567b | 2022-10-19 18:39:44 | 2022-10-19 18:39:46 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false), cin.tie(nullptr);
int N;
cin >> N;
vector<int> A(1 << N);
for (int& x : A) {
cin >> x;
}
for (int m = 0; m < (1 << N); m++) {
for (int i = 0; i < N; i++) {
if (m & (1 << i)) continue;
for (int j = i+1; j < N; j++) {
if (m & (1 << j)) continue;
if (A[m + (1 << i)] + A[m + (1 << j)] < A[m] + A[m + (1 << i) + (1 << j)]) {
cout << m + (1 << i) << ' ' << m + (1 << j) << '\n';
exit(0);
}
}
}
}
cout << -1 << '\n';
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 3ms
memory: 3552kb
input:
2 0 1 1 2
output:
-1
result:
ok Correct
Test #2:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
2 0 1 1 3
output:
1 2
result:
ok Correct
Test #3:
score: 0
Accepted
time: 2ms
memory: 3724kb
input:
0 100
output:
-1
result:
ok Correct
Test #4:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
12 0 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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...
output:
-1
result:
ok Correct
Test #5:
score: 0
Accepted
time: 2ms
memory: 3676kb
input:
12 0 1 1 2 1 2 2 3 1 2 2 3 2 3 3 4 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 3 4 4 5 4 5 5 6 4 5 5 6 5 6 6 7 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3...
output:
-1
result:
ok Correct
Test #6:
score: 0
Accepted
time: 3ms
memory: 3680kb
input:
14 0 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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...
output:
-1
result:
ok Correct
Test #7:
score: 0
Accepted
time: 5ms
memory: 3772kb
input:
14 0 1 1 2 1 2 2 3 1 2 2 3 2 3 3 4 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 3 4 4 5 4 5 5 6 4 5 5 6 5 6 6 7 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3...
output:
-1
result:
ok Correct
Test #8:
score: 0
Accepted
time: 32ms
memory: 3792kb
input:
17 0 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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...
output:
-1
result:
ok Correct
Test #9:
score: 0
Accepted
time: 27ms
memory: 3724kb
input:
17 0 1 1 2 1 2 2 3 1 2 2 3 2 3 3 4 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 3 4 4 5 4 5 5 6 4 5 5 6 5 6 6 7 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3...
output:
-1
result:
ok Correct
Test #10:
score: 0
Accepted
time: 70ms
memory: 4176kb
input:
18 0 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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...
output:
-1
result:
ok Correct
Test #11:
score: 0
Accepted
time: 70ms
memory: 4164kb
input:
18 0 1 1 2 1 2 2 3 1 2 2 3 2 3 3 4 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 3 4 4 5 4 5 5 6 4 5 5 6 5 6 6 7 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3...
output:
-1
result:
ok Correct
Test #12:
score: 0
Accepted
time: 312ms
memory: 7464kb
input:
20 0 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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...
output:
-1
result:
ok Correct
Test #13:
score: 0
Accepted
time: 281ms
memory: 7388kb
input:
20 0 1 1 2 1 2 2 3 1 2 2 3 2 3 3 4 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 3 4 4 5 4 5 5 6 4 5 5 6 5 6 6 7 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3...
output:
-1
result:
ok Correct
Test #14:
score: 0
Accepted
time: 3ms
memory: 3572kb
input:
12 9999998 9999996 9999996 9999992 9999996 9999992 9999992 9999984 9999996 9999992 9999992 9999984 9999992 9999984 9999984 9999968 9999996 9999992 9999992 9999984 9999992 9999984 9999984 9999968 9999992 9999984 9999984 9999968 9999984 9999968 9999968 9999936 9999996 9999992 9999992 9999984 9999992 9...
output:
1024 2048
result:
ok Correct
Test #15:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
14 9999998 9999996 9999996 9999992 9999996 9999992 9999992 9999984 9999996 9999992 9999992 9999984 9999992 9999984 9999984 9999968 9999996 9999992 9999992 9999984 9999992 9999984 9999984 9999968 9999992 9999984 9999984 9999968 9999984 9999968 9999968 9999936 9999996 9999992 9999992 9999984 9999992 9...
output:
4096 8192
result:
ok Correct
Test #16:
score: 0
Accepted
time: 8ms
memory: 4064kb
input:
17 9999998 9999996 9999996 9999992 9999996 9999992 9999992 9999984 9999996 9999992 9999992 9999984 9999992 9999984 9999984 9999968 9999996 9999992 9999992 9999984 9999992 9999984 9999984 9999968 9999992 9999984 9999984 9999968 9999984 9999968 9999968 9999936 9999996 9999992 9999992 9999984 9999992 9...
output:
32768 65536
result:
ok Correct
Test #17:
score: 0
Accepted
time: 101ms
memory: 7652kb
input:
20 9999998 9999996 9999996 9999992 9999996 9999992 9999992 9999984 9999996 9999992 9999992 9999984 9999992 9999984 9999984 9999968 9999996 9999992 9999992 9999984 9999992 9999984 9999984 9999968 9999992 9999984 9999984 9999968 9999984 9999968 9999968 9999936 9999996 9999992 9999992 9999984 9999992 9...
output:
262144 524288
result:
ok Correct
Test #18:
score: 0
Accepted
time: 320ms
memory: 7392kb
input:
20 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 ...
output:
-1
result:
ok Correct
Test #19:
score: 0
Accepted
time: 4ms
memory: 3560kb
input:
14 0 287591 280332 513369 288652 477661 551010 685465 208821 396938 464307 597870 467487 557022 704999 739980 383454 590303 579332 731627 653998 762265 831902 885615 579099 686474 750131 802952 819657 828450 972715 926954 267900 553415 491856 722817 531352 718285 737334 869713 474407 660448 673517 8...
output:
-1
result:
ok Correct
Test #20:
score: 0
Accepted
time: 36ms
memory: 3688kb
input:
17 0 340669 312301 598416 390680 632767 685007 872540 238892 480087 526347 712988 599586 742199 869067 957126 467164 727091 695011 900384 839736 1001081 1049609 1156400 692880 853333 895881 1001780 1035466 1097337 1220493 1227810 345073 683666 600998 885037 710553 950564 948504 1133961 581651 820770...
output:
-1
result:
ok Correct
Test #21:
score: 0
Accepted
time: 298ms
memory: 7416kb
input:
20 0 434418 373306 753170 489819 825655 845151 1126433 260418 595362 608878 889268 720251 956613 1050737 1232545 555130 908806 843982 1143104 1026841 1281935 1297719 1498259 802372 1056574 1066378 1266026 1244097 1399717 1490129 1591195 459532 891874 776462 1154250 924151 1257911 1223107 1502313 717...
output:
-1
result:
ok Correct
Test #22:
score: 0
Accepted
time: 4ms
memory: 3620kb
input:
14 0 287591 280332 513369 288652 477661 551010 685465 208821 396938 464307 597870 467487 557022 704999 739980 383454 590303 579332 731627 653998 762265 831902 885615 579099 686474 750131 802952 819657 828450 972715 926954 267900 553415 491856 722817 531352 718285 737334 869713 474407 660448 673517 8...
output:
197 4292
result:
ok Correct
Test #23:
score: 0
Accepted
time: 17ms
memory: 4192kb
input:
17 0 340669 312301 598416 390680 632767 685007 872540 238892 480087 526347 712988 599586 742199 869067 957126 467164 727091 695011 900384 839736 1001081 1049609 1156400 692880 853333 895881 1001780 1035466 1097337 1220493 1227810 345073 683666 600998 885037 710553 950564 948504 1133961 581651 820770...
output:
1547 3593
result:
ok Correct
Test #24:
score: 0
Accepted
time: 95ms
memory: 7600kb
input:
20 0 434418 373306 753170 489819 825655 845151 1126433 260418 595362 608878 889268 720251 956613 1050737 1232545 555130 908806 843982 1143104 1026841 1281935 1297719 1498259 802372 1056574 1066378 1266026 1244097 1399717 1490129 1591195 459532 891874 776462 1154250 924151 1257911 1223107 1502313 717...
output:
3899 7994
result:
ok Correct
Test #25:
score: 0
Accepted
time: 6ms
memory: 3716kb
input:
14 0 1 1 2 1 2 2 3 1 2 2 3 2 3 3 4 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 3 4 4 5 4 5 5 6 4 5 5 6 5 6 6 7 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3...
output:
-1
result:
ok Correct
Test #26:
score: 0
Accepted
time: 27ms
memory: 3560kb
input:
17 0 1 1 2 1 2 2 3 1 2 2 3 2 3 3 4 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 3 4 4 5 4 5 5 6 4 5 5 6 5 6 6 7 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3...
output:
-1
result:
ok Correct
Test #27:
score: 0
Accepted
time: 284ms
memory: 7340kb
input:
20 0 1 1 2 1 2 2 3 1 2 2 3 2 3 3 4 1 2 2 3 2 3 2 3 2 3 3 4 3 4 3 4 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 3 4 3 4 4 5 4 5 4 5 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 3 4 3 4 4 5 4 5 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 3 4 4 5 4 5 4 5 4 5 5 6 5 6 5 6 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3...
output:
-1
result:
ok Correct
Test #28:
score: 0
Accepted
time: 3ms
memory: 3700kb
input:
14 0 1 1 2 1 2 2 3 1 2 2 3 2 3 3 4 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 3 4 4 5 4 5 5 6 4 5 5 6 5 6 6 7 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3...
output:
591 2631
result:
ok Correct
Test #29:
score: 0
Accepted
time: 4ms
memory: 4216kb
input:
17 0 1 1 2 1 2 2 3 1 2 2 3 2 3 3 4 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 3 4 4 5 4 5 5 6 4 5 5 6 5 6 6 7 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3...
output:
4399 20779
result:
ok Correct
Test #30:
score: 0
Accepted
time: 77ms
memory: 7732kb
input:
20 0 1 1 2 1 2 2 3 1 2 2 3 2 3 3 4 1 2 2 3 2 3 2 3 2 3 3 4 3 4 3 4 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 3 4 3 4 4 5 4 5 4 5 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 3 4 3 4 4 5 4 5 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 3 4 4 5 4 5 4 5 4 5 5 6 5 6 5 6 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3...
output:
91469 222540
result:
ok Correct
Test #31:
score: 0
Accepted
time: 1ms
memory: 3612kb
input:
14 0 500001 500002 1000003 500004 1000005 1000006 1500007 500008 1000009 1000010 1500011 1000012 1500013 1500014 2000015 500016 1000017 1000018 1500019 1000020 1500021 1500022 2000023 1000024 1500025 1500026 2000027 1500028 2000029 2000030 2500031 500032 1000033 1000034 1500035 1000036 1500037 15000...
output:
229 357
result:
ok Correct
Test #32:
score: 0
Accepted
time: 9ms
memory: 4160kb
input:
17 0 500001 500002 1000003 500004 1000005 1000006 1500007 500008 1000009 1000010 1500011 1000012 1500013 1500014 2000015 500016 1000017 1000018 1500019 1000020 1500021 1500022 2000023 1000024 1500025 1500026 2000027 1500028 2000029 2000030 2500031 500032 1000033 1000034 1500035 1000036 1500037 15000...
output:
229 357
result:
ok Correct
Test #33:
score: 0
Accepted
time: 18ms
memory: 4680kb
input:
18 0 500001 500002 1000003 500004 1000005 1000006 1500007 500008 1000009 1000010 1500011 1000012 1500013 1500014 2000015 500016 1000017 1000018 1500019 1000020 1500021 1500022 2000023 1000024 1500025 1500026 2000027 1500028 2000029 2000030 2500031 500032 1000033 1000034 1500035 1000036 1500037 15000...
output:
229 357
result:
ok Correct
Test #34:
score: 0
Accepted
time: 5ms
memory: 3620kb
input:
14 0 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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...
output:
8191 12287
result:
ok Correct
Test #35:
score: 0
Accepted
time: 17ms
memory: 4068kb
input:
17 0 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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...
output:
65535 98303
result:
ok Correct
Test #36:
score: 0
Accepted
time: 149ms
memory: 7660kb
input:
20 0 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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...
output:
524287 786431
result:
ok Correct
Test #37:
score: 0
Accepted
time: 136ms
memory: 7748kb
input:
20 9999998 9999996 9999996 9999992 9999996 9999992 9999992 9999984 9999996 9999992 9999992 9999984 9999992 9999984 9999984 9999968 9999996 9999992 9999992 9999984 9999992 9999984 9999984 9999968 9999992 9999984 9999984 9999968 9999984 9999968 9999968 9999936 9999996 9999992 9999992 9999984 9999992 9...
output:
491520 753664
result:
ok Correct
Test #38:
score: 0
Accepted
time: 153ms
memory: 7596kb
input:
20 9999998 9999996 9999996 9999992 9999996 9999992 9999992 9999984 9999996 9999992 9999992 9999984 9999992 9999984 9999984 9999968 9999996 9999992 9999992 9999984 9999992 9999984 9999984 9999968 9999992 9999984 9999984 9999968 9999984 9999968 9999968 9999936 9999996 9999992 9999992 9999984 9999992 9...
output:
507904 770048
result:
ok Correct
Test #39:
score: 0
Accepted
time: 159ms
memory: 7660kb
input:
20 9999998 9999996 9999996 9999992 9999996 9999992 9999992 9999984 9999996 9999992 9999992 9999984 9999992 9999984 9999984 9999968 9999996 9999992 9999992 9999984 9999992 9999984 9999984 9999968 9999992 9999984 9999984 9999968 9999984 9999968 9999968 9999936 9999996 9999992 9999992 9999984 9999992 9...
output:
516096 778240
result:
ok Correct
Test #40:
score: 0
Accepted
time: 2ms
memory: 3724kb
input:
3 2040 17078 28734 21453 5210 16891 6250 12181
output:
3 6
result:
ok Correct