QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#884194 | #10008. Isn't It Beautiful? | Kevin5307 | AC ✓ | 76ms | 3808kb | C++23 | 1.2kb | 2025-02-05 22:01:54 | 2025-02-05 22:02:06 |
Judging History
answer
//Author: Kevin
#include<bits/stdc++.h>
//#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define ull unsigned ll
#define pb emplace_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (int)(x.size())
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin())
#define uni(v) v.resize(unique(ALL(v))-v.begin())
#define longer __int128_t
void die(string S){puts(S.c_str());exit(0);}
void solve()
{
int n;
cin>>n;
vector<int> vec(n);
for(auto &x:vec) cin>>x;
int ans=0;
for(int d=29;d>=0;d--)
{
for(auto &x:vec) x&=((1<<(d+1))-1);
srt(vec);
uni(vec);
int cnt0=0;
for(auto x:vec) if(!(x>>d&1)) cnt0++;
if(cnt0==(1<<d))
{
ans=(1<<(d+1))-1;
break;
vector<int> nvec;
for(auto x:vec)
if(x>>d&1)
nvec.pb(x);
swap(vec,nvec);
}
}
cout<<ans<<'\n';
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t;
cin>>t;
while(t--)
solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3584kb
input:
1 6 13 11 40 10 33 19
output:
7
result:
ok ok (1 test case)
Test #2:
score: 0
Accepted
time: 40ms
memory: 3584kb
input:
2240 61 504480583 220800155 565433298 371420012 825404978 523350662 450499933 369837413 415696969 560458948 710074240 248371716 502655880 510976986 941211285 493852175 673325427 606545283 555763764 848271246 729412332 630271332 470220824 778390746 264427786 229531301 267674352 437129089 513679682 10...
output:
31 7 31 7 63 63 63 1 31 63 7 15 3 63 63 63 63 15 15 15 15 31 31 31 31 63 7 63 31 31 15 15 63 3 15 31 31 63 15 3 63 31 7 31 31 1 31 7 15 3 63 15 7 31 63 3 31 63 31 63 15 15 15 63 15 15 63 31 15 15 63 31 63 63 7 63 3 15 15 31 7 15 3 63 31 31 31 31 31 1 3 7 7 3 1 63 31 63 31 31 1 15 31 63 63 63 1 1 63 ...
result:
ok ok (2240 test cases)
Test #3:
score: 0
Accepted
time: 21ms
memory: 3584kb
input:
1000 90 207638575 770422333 95913261 300102151 340025378 1013444937 884439100 77620238 384013091 680485399 74189825 915007006 855211346 332136450 887396651 596273730 1039555632 1024466246 420972321 93841411 395758163 835800842 948779349 394921753 903231562 885398093 129328720 526675733 82616604 5722...
output:
127 127 15 63 15 7 3 31 63 31 7 63 31 31 31 127 3 31 7 63 1 127 63 63 63 31 63 31 127 31 7 63 15 15 63 63 7 31 63 31 63 15 63 63 31 31 7 127 7 31 15 63 63 127 63 127 63 63 31 127 7 127 31 63 63 7 127 63 7 3 31 63 1 31 7 31 31 63 15 63 7 127 63 63 3 31 63 63 63 15 31 15 63 15 127 31 63 31 7 63 63 63 ...
result:
ok ok (1000 test cases)
Test #4:
score: 0
Accepted
time: 53ms
memory: 3712kb
input:
100 998 307993379 347523336 370522372 401672488 114332366 124646407 583410109 145455359 103915710 181645336 225119057 584333627 386790085 671398168 852402449 183239547 628476817 308013968 701766085 344464199 465998659 170691019 844738668 176327360 756978112 673468733 204922095 947087970 454365502 51...
output:
1023 511 31 1023 1023 31 255 511 127 1023 511 511 1023 255 1023 1023 1023 1023 255 511 511 1023 1023 1023 127 1023 1023 1023 1023 1023 127 1023 511 255 1023 511 511 31 127 1023 511 511 511 255 511 255 511 1023 511 1023 1023 1023 1023 127 1023 511 31 127 1023 1023 255 1023 511 511 1023 1023 1023 1023...
result:
ok ok (100 test cases)
Test #5:
score: 0
Accepted
time: 64ms
memory: 3712kb
input:
10 10000 1023446449 197775989 174371835 1008900861 854863978 643753297 612567423 626402001 20840362 560107195 723539579 683758360 758469406 456838829 118082548 849896815 167351909 1060194027 912818950 917289929 262096375 23168719 436098037 337396987 3688550 692799245 828355731 682085108 360549685 71...
output:
8191 8191 4095 2047 8191 8191 8191 1 16383 8191
result:
ok ok (10 test cases)
Test #6:
score: 0
Accepted
time: 23ms
memory: 3584kb
input:
18224 6 112197883 992841416 419392876 676610229 804098759 889311224 10 204139504 19026066 136007560 134387868 804745786 1044743080 914864460 427392726 453489486 559212966 6 150233041 403071986 301497379 380060080 944945524 1020245358 7 334723997 648693506 368630429 893888632 652429913 68401544 37122...
output:
3 1 7 3 1 15 7 7 1 1 7 7 15 1 3 1 7 3 1 3 3 1 3 1 1 1 3 3 3 1 3 3 3 1 3 3 3 1 3 1 15 7 7 7 15 3 3 7 1 7 1 3 3 3 3 1 7 3 3 7 15 3 7 1 7 3 3 3 1 7 3 7 7 3 1 15 3 7 7 7 1 3 3 3 3 1 15 1 3 3 3 3 1 1 7 1 1 1 1 7 7 15 7 7 7 1 1 1 3 7 3 7 1 7 3 7 1 7 1 7 7 1 3 3 3 7 7 3 7 7 1 3 15 7 1 3 1 3 1 7 3 3 3 3 1 1...
result:
ok ok (18224 test cases)
Test #7:
score: 0
Accepted
time: 41ms
memory: 3712kb
input:
1981 73 1017319215 623674420 700368178 1016666394 1028443448 113090334 129898814 1043253057 599666243 416353605 17827091 592608771 126261797 134736706 560252166 566564395 224983055 84508425 378357026 126661144 791757370 705195588 233501452 43568187 424298784 324902656 496787969 925829422 931078717 7...
output:
127 31 31 31 15 7 15 15 31 31 3 31 63 15 63 31 63 31 15 31 31 3 63 63 15 31 127 63 31 127 1 31 7 31 3 15 63 15 31 1 63 31 7 63 15 31 7 63 7 3 31 63 63 63 31 63 15 15 63 63 15 127 31 31 15 15 1 15 31 63 3 31 15 1 31 15 7 31 3 31 127 3 31 31 31 127 31 63 31 63 63 1 31 15 63 127 31 127 31 15 31 3 3 63 ...
result:
ok ok (1981 test cases)
Test #8:
score: 0
Accepted
time: 76ms
memory: 3688kb
input:
13 454 875170696 577634737 843842100 234818020 703914409 605937165 900492292 584771879 20368217 358275606 837049779 877522850 1022169399 398339654 514790409 62863405 51699750 280080889 545643576 174305188 191484601 504256553 347856669 151609532 349413283 609259711 453503196 184990453 302595266 92871...
output:
127 63 1023 4095 1 8191 127 8191 1023 1023 511 16383 7
result:
ok ok (13 test cases)
Test #9:
score: 0
Accepted
time: 1ms
memory: 3712kb
input:
100 9 935571715 315284083 454332773 259710736 529472681 537204211 551933763 35415393 825535552 4 449180000 751534551 564016457 38792405 3 291619192 531264062 986719924 9 127785916 551262243 654183090 315633865 136520321 360956704 1029577412 1022334325 3944982 7 922718328 476314630 410750096 35100770...
output:
3 3 1 7 3 1 7 7 7 7 1 1 3 7 7 1 3 3 7 3 3 3 7 7 1 7 7 1 3 1 1 7 3 1 3 1 7 1 15 1 7 7 1 3 7 1 7 1 1 3 7 3 15 1 3 3 1 7 7 7 7 7 7 3 3 15 3 3 3 7 3 7 1 3 3 7 7 7 3 15 1 1 15 3 15 1 1 1 3 15 7 1 7 15 1 7 7 7 3 3
result:
ok ok (100 test cases)
Test #10:
score: 0
Accepted
time: 71ms
memory: 3808kb
input:
1 100000 401138242 1035620813 1041246762 808229950 565829922 1046007577 260628758 902327237 117269312 663025766 684518046 286287408 243061620 995920592 150779484 38286517 67296482 63191102 697837403 871910183 217068949 505412398 851997823 142022941 336134173 691061830 1014343363 845569133 388247827 ...
output:
131071
result:
ok ok (1 test case)
Test #11:
score: 0
Accepted
time: 49ms
memory: 3712kb
input:
204 597 790969046 1052508772 468733003 826889730 26811560 144439533 1025300757 3114300 1057098227 534951426 794771517 807044788 519445002 984215583 268027226 510162069 163874759 837611670 51140868 946574708 291723907 245290081 363179096 421712563 864127243 611414983 124566426 972446638 691465917 106...
output:
255 511 511 255 1 255 127 255 511 127 15 511 511 511 255 255 1023 31 63 63 1023 1023 127 511 255 511 7 127 1023 255 31 63 255 511 1023 255 127 1023 511 31 127 127 127 1023 511 127 255 255 511 1 31 255 255 255 63 255 31 63 255 511 1 511 511 63 63 511 255 255 63 1023 255 255 15 1023 127 255 255 7 255 ...
result:
ok ok (204 test cases)
Test #12:
score: 0
Accepted
time: 62ms
memory: 3712kb
input:
29 5446 219889504 604100151 376679055 708413224 214763847 379491841 871133838 447073957 279078497 237860127 276665622 499159758 377155775 946188626 673030775 424924852 844509751 18502175 914565004 55194476 227467562 426521032 116055593 721705703 461444320 877757901 1043474144 323688180 390598309 907...
output:
2047 1023 2047 8191 8191 15 15 1023 2047 4095 2047 8191 4095 127 1 1023 511 4095 2047 2047 255 1023 3 1023 255 2047 63 1023 8191
result:
ok ok (29 test cases)
Test #13:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
8 1 1 2 1 3 3 1 3 7 2 15 65535 3 7 32767 1073741823 10 1 3 7 15 31 63 127 255 511 1023 10 2047 4095 8191 16383 32767 65535 131071 262143 524287 1048575 10 2097151 4194303 8388607 16777215 33554431 67108863 134217727 268435455 536870911 1073741823
output:
0 0 0 0 0 0 0 0
result:
ok ok (8 test cases)
Test #14:
score: 0
Accepted
time: 27ms
memory: 3712kb
input:
100000 1 112117371 1 1057046787 1 550666595 1 167811915 1 820120135 1 237242817 1 73498723 1 33571075 1 612391441 1 271161 1 675709095 1 10559937 1 72354307 1 678961825 1 805437507 1 232000769 1 134217867 1 611005129 1 158128257 1 403213069 1 906888741 1 270991451 1 177415371 1 25763231 1 365017155 ...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok ok (100000 test cases)
Test #15:
score: 0
Accepted
time: 38ms
memory: 3584kb
input:
1 100000 110106113 178223381 78024489 574630033 33796297 165225561 269234547 593449509 9326885 49957649 339823617 571695491 27804225 134490569 138644451 21513813 547824801 141051175 13080701 684195855 571485959 354599315 242655931 75853213 201867845 374367731 268445697 573358723 589438991 69484569 1...
output:
0
result:
ok ok (1 test case)
Test #16:
score: 0
Accepted
time: 42ms
memory: 3584kb
input:
1000 100 479815715 371931405 554740417 13380719 507581341 589304735 603990283 832194769 134365189 231883 520098003 100802625 606212489 51421715 82434061 157503897 642131915 822150661 2246833 37816331 67923113 324551459 10682385 620826185 268583623 846256453 41254917 5344723 833645773 136335629 37160...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok ok (1000 test cases)
Test #17:
score: 0
Accepted
time: 28ms
memory: 3584kb
input:
100000 1 8099583 1 2195991 1 34603031 1 5455 1 88146471 1 578936855 1 21917815 1 335678871 1 849365583 1 906304543 1 20005959 1 129631247 1 136250495 1 272111783 1 8392711 1 922763279 1 5396839 1 10519879 1 206691463 1 67145935 1 973481223 1 138497359 1 144803663 1 843114511 1 251811575 1 843919887 ...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok ok (100000 test cases)
Test #18:
score: 0
Accepted
time: 34ms
memory: 3584kb
input:
1 100000 236216407 31745047 145803295 640555015 76087583 565389407 34751479 21563471 124004519 872808655 588490199 169083943 152726583 444942247 577618735 285761799 538812935 537444535 136213071 176779911 168567383 537411727 69494951 139200599 361570343 204996655 840538247 943789767 187975959 288571...
output:
0
result:
ok ok (1 test case)
Test #19:
score: 0
Accepted
time: 38ms
memory: 3584kb
input:
1000 100 272754903 872778551 302255791 122958215 275911447 305417863 25168159 28607223 373297679 497136199 293640719 136315471 238122951 10761767 4405047 538090783 118003615 143631183 880837815 748750535 570434055 950166279 557942087 123733583 504695559 553718855 559895 209774607 169297159 17992071 ...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok ok (1000 test cases)
Test #20:
score: 0
Accepted
time: 27ms
memory: 3584kb
input:
100000 1 40306687 1 432621567 1 604256255 1 756219903 1 619190271 1 588154879 1 624072703 1 808472575 1 17911807 1 310190079 1 17471487 1 189011967 1 100771839 1 810704895 1 738279423 1 5251071 1 600985599 1 270878719 1 68816895 1 3747839 1 926568447 1 278925311 1 60301311 1 21043199 1 147154943 1 4...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok ok (100000 test cases)
Test #21:
score: 0
Accepted
time: 17ms
memory: 3712kb
input:
1 100000 34088959 344459263 546977791 415041535 549636095 214241279 767588351 162793471 203991039 1028130815 861673471 885540863 50501631 142608383 689182719 172234751 152270847 210276351 21170175 38307839 16084991 791162879 790527 829698047 708841471 390072319 289591295 383858687 167839743 47100927...
output:
0
result:
ok ok (1 test case)
Test #22:
score: 0
Accepted
time: 27ms
memory: 3584kb
input:
1000 100 8525823 25317375 71411711 676341759 750786559 284710911 740358143 142671871 706752511 940199935 5367807 84058111 202987519 260968447 51388415 285243391 616826879 303122431 428197887 270845951 704645119 43927551 167860223 360749055 336906239 143359 404768767 44570623 78647295 110958591 61146...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok ok (1000 test cases)
Test #23:
score: 0
Accepted
time: 26ms
memory: 3584kb
input:
100000 1 136314879 1 616562687 1 497025023 1 274726911 1 908066815 1 195035135 1 10485759 1 113246207 1 54525951 1 140509183 1 35651583 1 88080383 1 278921215 1 2097151 1 476053503 1 341835775 1 37748735 1 794820607 1 274726911 1 320864255 1 710934527 1 6291455 1 207618047 1 270532607 1 547356671 1 ...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok ok (100000 test cases)
Test #24:
score: 0
Accepted
time: 8ms
memory: 3712kb
input:
1 100000 404750335 2097151 331350015 503316479 287309823 23068671 226492415 144703487 975175679 941621247 878706687 673185791 884998143 555745279 482344959 255852543 50331647 161480703 583008255 16777215 574619647 555745279 545259519 455081983 188743679 950009855 377487359 113246207 677380095 102760...
output:
0
result:
ok ok (1 test case)
Test #25:
score: 0
Accepted
time: 12ms
memory: 3584kb
input:
1000 100 111149055 104857599 608174079 169869311 33554431 199229439 140509183 6291455 35651583 180355071 169869311 52428799 1031798783 564133887 606076927 973078527 939524095 524287999 991952895 291504127 37748735 832569343 610271231 840957951 555745279 27262975 574619647 673185791 1000341503 350224...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok ok (1000 test cases)