Task: | Inheritance |
Sender: | Barren plateau |
Submission time: | 2024-11-16 15:58:16 +0200 |
Language: | C++ (C++17) |
Status: | READY |
Result: | RUNTIME ERROR |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 1.04 s | details |
#2 | ACCEPTED | 1.11 s | details |
#3 | ACCEPTED | 1.01 s | details |
#4 | ACCEPTED | 1.22 s | details |
#5 | ACCEPTED | 2.49 s | details |
#6 | ACCEPTED | 2.49 s | details |
#7 | RUNTIME ERROR | 2.50 s | details |
#8 | RUNTIME ERROR | 2.50 s | details |
#9 | ACCEPTED | 2.49 s | details |
#10 | ACCEPTED | 2.49 s | details |
#11 | ACCEPTED | 2.50 s | details |
#12 | ACCEPTED | 1.96 s | details |
#13 | ACCEPTED | 1.94 s | details |
#14 | ACCEPTED | 1.92 s | details |
#15 | ACCEPTED | 2.50 s | details |
#16 | ACCEPTED | 2.49 s | details |
#17 | ACCEPTED | 2.49 s | details |
#18 | ACCEPTED | 2.49 s | details |
#19 | ACCEPTED | 2.50 s | details |
#20 | ACCEPTED | 2.49 s | details |
#21 | ACCEPTED | 2.50 s | details |
#22 | ACCEPTED | 2.50 s | details |
#23 | ACCEPTED | 2.49 s | details |
#24 | ACCEPTED | 2.49 s | details |
#25 | ACCEPTED | 2.51 s | details |
#26 | ACCEPTED | 2.50 s | details |
#27 | ACCEPTED | 2.49 s | details |
#28 | ACCEPTED | 2.49 s | details |
Code
#include <bits/stdc++.h> using namespace std; using Z = long long int; Z n; vector<Z> V; int main() { cin.sync_with_stdio(false); cin.tie(nullptr); cin >> n; V.resize(n); for(Z i = 0; i < n; ++i) { cin >> V[i]; } mt19937 rng(13423562572); Z bound = (Z{1} << n) - 1; vector<pair<Z, Z>> X; for(Z it = 0; it < 10000000; ++it) { Z mask = (Z)(uniform_int_distribution<uint64_t>()(rng) & (uint64_t)bound); Z diff = 0; for(Z i = 0; i < n; ++i) { if(mask & (Z{1} << i)) { diff += V[i]; } else { diff -= V[i]; } } if(diff < 0) { diff = -diff; mask = bound & ~mask; } X.push_back({diff, mask}); } std::sort(X.begin(), X.end(), [&](const pair<Z, Z>& a, const pair<Z, Z>& b) { return a.first < b.first; }); for(Z i = 1; i < (Z)X.size(); ++i) { if(X[i - 1].first == X[i].first) { Z mask1 = X[i - 1].second; Z mask2 = X[i].second; Z a = mask1 & ~mask2; Z b = mask2 & ~mask1; if(a && b) { for(Z i = 0; i < n; ++i) { if(a & (Z{1} << i)) { cout << V[i] << " "; } } cout << "\n"; for(Z i = 0; i < n; ++i) { if(b & (Z{1} << i)) { cout << V[i] << " "; } } cout << "\n"; return 0; } } } throw 5; return 0; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
2 1 1 |
correct output |
---|
1 1 |
user output |
---|
1 1 |
Test 2
Verdict: ACCEPTED
input |
---|
3 1 2 3 |
correct output |
---|
3 1 2 |
user output |
---|
3 1 2 |
Test 3
Verdict: ACCEPTED
input |
---|
3 2 2 2 |
correct output |
---|
2 2 |
user output |
---|
2 2 |
Test 4
Verdict: ACCEPTED
input |
---|
6 3 2 5 1 7 8 |
correct output |
---|
2 1 3 |
user output |
---|
3 2 5 |
Test 5
Verdict: ACCEPTED
input |
---|
40 27487790693 27487790692 274877... |
correct output |
---|
27487790651 27487774282 27487790652 27487774281 |
user output |
---|
27487790690 27487790686 274877... |
Test 6
Verdict: ACCEPTED
input |
---|
40 27487790693 27487790692 274877... |
correct output |
---|
27487790688 27487790486 274877... |
user output |
---|
27487790674 27487790637 274877... |
Test 7
Verdict: RUNTIME ERROR
input |
---|
40 1 2 4 8 16 32 64 128 256 512 1... |
correct output |
---|
549755813887 1 2 4 8 16 32 64 128 256 512 1... |
user output |
---|
(empty) |
Error:
terminate called after throwing an instance of 'int'
Test 8
Verdict: RUNTIME ERROR
input |
---|
40 1 2 4 8 16 32 64 128 256 512 1... |
correct output |
---|
274877906943 1 2 4 8 16 32 64 128 256 512 1... |
user output |
---|
(empty) |
Error:
terminate called after throwing an instance of 'int'
Test 9
Verdict: ACCEPTED
input |
---|
40 1 3 7 15 31 63 127 255 511 102... |
correct output |
---|
1 7 31 2047 4095 68719476735 2... |
user output |
---|
15 2047 65535 131071 262143 33... |
Test 10
Verdict: ACCEPTED
input |
---|
40 1 3 5 10 20 40 80 160 320 640 ... |
correct output |
---|
5 40 80 640 1280 10240 20480 1... |
user output |
---|
5242880 83886080 1342177280 53... |
Test 11
Verdict: ACCEPTED
input |
---|
40 642081522561 67331511756 17915... |
correct output |
---|
10000000008 10000000005 10000000007 10000000006 |
user output |
---|
10000000029 10000000012 100000... |
Test 12
Verdict: ACCEPTED
input |
---|
40 27487790739 27487790734 274877... |
correct output |
---|
27487790739 27487790701 274877... |
user output |
---|
27487790737 27487790702 274877... |
Test 13
Verdict: ACCEPTED
input |
---|
40 27487790726 27487790723 274877... |
correct output |
---|
27487790681 27487790678 27487790680 27487790679 |
user output |
---|
27487790726 27487790748 274877... |
Test 14
Verdict: ACCEPTED
input |
---|
40 27487790744 27487790715 274877... |
correct output |
---|
27487790711 27487790710 274877... |
user output |
---|
27487790710 27487790706 274877... |
Test 15
Verdict: ACCEPTED
input |
---|
40 19669566523 16528665765 196239... |
correct output |
---|
16528665765 10929136447 125755... |
user output |
---|
19669566523 19623932705 125755... |
Test 16
Verdict: ACCEPTED
input |
---|
40 18103769567 14444217460 183355... |
correct output |
---|
15982577206 17769110557 124644... |
user output |
---|
15982577206 16010998271 124644... |
Test 17
Verdict: ACCEPTED
input |
---|
40 17856614174 19048069863 175427... |
correct output |
---|
17563061793 16010946154 132865... |
user output |
---|
17563061793 16754109846 184478... |
Test 18
Verdict: ACCEPTED
input |
---|
40 1786812 2068856 1749503 168298... |
correct output |
---|
2068856 2090472 1725454 169431... |
user output |
---|
1786812 1984383 1735504 159945... |
Test 19
Verdict: ACCEPTED
input |
---|
40 1129650 1662217 1678779 182047... |
correct output |
---|
1820473 1456513 1939701 160831... |
user output |
---|
1820473 2027113 1660276 140085... |
Test 20
Verdict: ACCEPTED
input |
---|
40 24808689091 27070970684 226856... |
correct output |
---|
22685667072 25049152240 183404... |
user output |
---|
20249742938 15146917475 166598... |
Test 21
Verdict: ACCEPTED
input |
---|
40 16712721711 16122645964 169234... |
correct output |
---|
25590302248 25776083681 200636... |
user output |
---|
16923456895 19004163920 245811... |
Test 22
Verdict: ACCEPTED
input |
---|
40 27016877723 26624688594 255882... |
correct output |
---|
18637668548 14215273154 231053... |
user output |
---|
27005623777 18191692253 259950... |
Test 23
Verdict: ACCEPTED
input |
---|
40 22612801338 17987950258 220495... |
correct output |
---|
22612801338 28914153399 201796... |
user output |
---|
22612801338 22049531790 178789... |
Test 24
Verdict: ACCEPTED
input |
---|
40 23397776706 18089114838 194902... |
correct output |
---|
17041900579 24486781810 275051... |
user output |
---|
23592548295 17041900579 244867... |
Test 25
Verdict: ACCEPTED
input |
---|
40 24840659504 32664220268 190864... |
correct output |
---|
32664220268 19086427470 240084... |
user output |
---|
24840659504 19086427470 170438... |
Test 26
Verdict: ACCEPTED
input |
---|
40 22577006557 25490929450 308237... |
correct output |
---|
22577006557 33714917325 183357... |
user output |
---|
35494095564 25493455844 297389... |
Test 27
Verdict: ACCEPTED
input |
---|
40 25196082534 25787578777 336717... |
correct output |
---|
20236894598 25724569573 318791... |
user output |
---|
33671758794 20236894598 196695... |
Test 28
Verdict: ACCEPTED
input |
---|
40 5000000000 5000000001 50000000... |
correct output |
---|
5000000002 5000000594 50000022... |
user output |
---|
5000000001 5000000004 50000000... |