QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#347438 | #8332. Two in One | ucup-team2303# | AC ✓ | 18ms | 4892kb | C++20 | 1.1kb | 2024-03-09 13:48:35 | 2024-03-09 13:48:35 |
Judging History
answer
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2")
#include <bits/stdc++.h>
// #define int long long
#define i64 long long
#define pii pair <int, int>
using namespace std;
inline int read(void) {
int x=0,sgn=1; char ch=getchar();
while(ch<48||57<ch) {if(ch==45)sgn=0;ch=getchar();}
while(47<ch&&ch<58) {x=x*10+ch-48; ch=getchar();}
return sgn? x:-x;
}
void write(int x) {
if(x<0) putchar('-'),x=-x;
if(x>9) write(x/10);
putchar(x%10+'0');
}
int n;
int f[200005];
int cnt[100005];
inline void work() {
for(int i=1; i<=n; ++i) cnt[i]=0;
n=read(); int Ans=0;
for(int i=1; i<=n; ++i) ++cnt[read()];
sort(cnt+1,cnt+n+1);
Ans=cnt[n];
for(int i=1; i<n; ++i)
Ans=max(Ans,cnt[n]|cnt[i]|f[cnt[n]&cnt[i]]);
write(Ans); puts("");
}
/*
write((Ans%p+p)%p); pls
*/
signed main() {
for(int i=2; i<=200000; ++i) f[i]=f[i>>1]<<1|1;
int T=read();
while(T--) work();
return 0;
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 4524kb
input:
1 7 1 2 3 4 3 2 1
output:
3
result:
ok 1 number(s): "3"
Test #2:
score: 0
Accepted
time: 1ms
memory: 4456kb
input:
1 9 1 1 1 1 1 2 2 2 2
output:
7
result:
ok 1 number(s): "7"
Test #3:
score: 0
Accepted
time: 5ms
memory: 4472kb
input:
50 10000 72 65 90 94 67 93 41 43 54 83 31 34 38 37 44 42 92 63 66 79 90 45 41 40 19 54 34 90 13 74 40 77 41 57 74 86 91 79 34 39 21 88 90 57 23 31 8 15 80 27 45 38 53 96 51 82 70 71 19 75 62 95 31 67 99 97 94 29 90 7 95 82 61 98 62 77 43 65 66 30 41 69 38 79 51 9 63 77 13 30 72 70 67 93 92 45 74 50 ...
output:
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
result:
ok 50 numbers
Test #4:
score: 0
Accepted
time: 9ms
memory: 4448kb
input:
79114 7 1 2 4 3 2 3 7 7 1 2 4 7 4 1 5 6 4 2 2 4 2 1 7 1 2 1 4 7 3 2 7 1 2 4 7 1 1 3 7 1 2 6 1 5 2 5 6 5 2 6 1 2 5 7 1 1 7 6 6 5 2 7 1 2 5 6 6 7 7 7 1 1 2 7 2 3 6 7 1 1 1 4 6 2 2 7 1 1 5 7 3 5 2 7 1 1 7 6 2 2 5 6 4 3 4 6 3 1 6 4 4 3 2 3 1 7 1 1 2 3 7 6 2 6 1 2 5 6 3 4 7 1 1 1 1 4 7 6 6 2 6 6 2 5 3 6 ...
output:
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 1 5 3 3 3 3 3 3 3 3 3 3 3 5 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 6 3 3 3 3 5 3 3 3 5 3 3 3 3 3 3 3 3 3 3 5 3 3 3 3 3 3 3 3 3 3 3 5 3 3 3 1 3 3 3 3 3 3 5 3 3 3 3 3 3 3 3 3 3 ...
result:
ok 79114 numbers
Test #5:
score: 0
Accepted
time: 9ms
memory: 4448kb
input:
50000 10 6 3 8 5 4 6 3 5 3 9 10 10 4 3 10 4 5 2 7 8 10 10 10 6 2 2 4 9 7 3 3 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7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 9 7 7 7 7 7 9 7 10 7 7 7 7 7 7 10 7 7 7 7 7 7 7 7 7 7 7 7 7 10 7 7 7 7 7 7 7 7 7 7 7 7...
result:
ok 50000 numbers
Test #7:
score: 0
Accepted
time: 12ms
memory: 4460kb
input:
5000 100 35 13 56 51 37 39 100 35 21 36 54 19 99 74 38 99 90 69 29 23 38 27 40 94 92 93 93 45 94 22 65 65 43 62 47 53 11 77 87 15 77 72 3 38 25 19 4 82 48 69 15 13 8 76 48 8 19 86 25 26 34 70 38 42 87 81 31 92 30 24 80 69 8 74 48 30 57 47 65 42 35 47 42 85 18 94 97 13 8 24 100 31 51 72 69 95 74 90 9...
output:
7 7 3 7 7 7 7 7 7 7 7 7 7 3 7 7 7 7 7 7 7 7 3 7 7 3 7 7 7 7 3 7 7 7 7 7 7 3 7 7 3 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 3 7 7 7 3 7 7 7 7 7 3 7 7 7 3 7 7 7 3 7 7 7 7 3 7 7 3 7 7 7 7 7 7 7 7 7 7 3 7 7 7 7 7 7 7 7 7 7 3 7 7 3 3 7 7 7 7 7 7 7 7 7 7 7 7 3 3 7 7 7 7 3 7 7 7 7 7 7 7 7 7 7 7 3 7 ...
result:
ok 5000 numbers
Test #8:
score: 0
Accepted
time: 6ms
memory: 4388kb
input:
5000 100 5 3 7 7 6 6 10 5 4 6 7 4 9 8 6 9 9 8 5 4 6 5 6 9 9 9 9 6 9 4 8 8 6 7 6 7 3 8 9 3 8 8 1 6 5 4 2 9 6 8 3 3 2 8 6 2 4 9 5 5 5 8 6 6 9 9 5 9 5 4 8 8 2 8 6 5 7 6 8 6 5 6 6 9 4 9 9 3 2 4 10 5 7 8 8 9 8 9 9 8 100 6 6 4 2 6 5 9 9 6 7 9 7 6 6 3 3 4 9 7 7 9 6 9 3 6 3 10 6 8 9 8 9 5 6 3 3 5 9 8 8 8 1 ...
output:
31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 ...
result:
ok 5000 numbers
Test #9:
score: 0
Accepted
time: 10ms
memory: 4496kb
input:
500 1000 826 799 36 103 143 218 173 682 364 907 788 338 489 308 749 437 185 166 973 723 463 220 892 883 126 274 442 324 227 772 349 202 740 43 361 521 690 113 160 281 364 507 913 552 766 661 82 931 590 896 439 701 330 538 939 710 841 660 620 727 309 506 113 55 230 459 734 675 977 737 922 642 860 894...
output:
7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 ...
result:
ok 500 numbers
Test #10:
score: 0
Accepted
time: 8ms
memory: 4524kb
input:
500 1000 28 28 6 10 11 14 13 26 19 30 28 18 22 17 27 20 13 12 31 26 21 14 29 29 11 16 21 18 15 27 18 14 27 6 19 22 26 10 12 16 19 22 30 23 27 25 9 30 24 29 20 26 18 23 30 26 29 25 24 26 17 22 10 7 15 21 27 25 31 27 30 25 29 29 25 24 9 10 16 24 29 23 19 16 28 21 28 12 31 10 20 18 11 21 14 11 14 12 19...
output:
63 63 127 127 63 127 125 63 127 127 127 126 127 63 63 63 127 127 127 127 63 127 126 127 127 127 127 127 127 63 127 127 127 63 127 127 123 127 63 127 63 119 127 63 125 127 127 63 127 127 123 126 127 127 63 127 125 127 127 119 127 127 119 127 127 63 63 127 63 63 127 127 127 63 122 63 127 127 127 63 63...
result:
ok 500 numbers
Test #11:
score: 0
Accepted
time: 10ms
memory: 4500kb
input:
50 10000 5231 4283 8159 8842 4592 8761 1749 1922 2947 6985 988 1176 1520 1420 2002 1812 8626 4019 4403 6360 8219 2027 1745 1619 395 2982 1182 8185 179 5604 1659 5959 1682 3355 5489 7484 8447 6328 1184 1555 477 7889 8272 3343 544 975 80 226 6518 729 2044 1450 2904 9281 2622 6742 4921 5143 372 5695 39...
output:
7 7 7 7 7 7 7 7 7 7 7 7 15 7 15 7 7 7 7 7 7 7 7 7 7 7 15 7 15 7 7 7 7 7 7 15 7 7 7 7 15 7 15 7 7 7 7 7 7 15
result:
ok 50 numbers
Test #12:
score: 0
Accepted
time: 18ms
memory: 4892kb
input:
5 100000 91675 46565 38979 3941 53894 98418 84900 84804 53487 7391 37558 42152 21892 48134 40091 35126 70005 1153 61201 47390 57436 20581 76773 48574 35571 42660 42943 41736 20593 53925 22043 8372 31184 39982 17663 22303 48407 27491 22257 13831 393 13278 29991 80618 89887 63441 66588 3667 95209 5383...
output:
7 15 7 15 15
result:
ok 5 number(s): "7 15 7 15 15"
Test #13:
score: 0
Accepted
time: 11ms
memory: 4828kb
input:
5 100000 302 215 197 62 232 313 291 291 231 85 193 205 147 219 200 187 264 33 247 217 239 143 277 220 188 206 207 204 143 232 148 91 176 199 132 149 220 165 149 117 19 115 173 283 299 251 258 60 308 232 146 306 197 294 154 246 245 305 134 237 129 217 233 192 65 210 290 153 309 212 229 155 157 33 260...
output:
1023 1023 1023 1023 1023
result:
ok 5 number(s): "1023 1023 1023 1023 1023"
Test #14:
score: 0
Accepted
time: 8ms
memory: 4768kb
input:
5 99999 5 5 5 5 5 5 4 5 4 5 5 5 5 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 5 5 5 5 5 4 5 5 5 5 4 5 5 3 5 5 5 5 5 5 5 5 3 5 5 4 5 5 5 3 5 5 5 5 5 5 5 5 5 5 5 4 5 5 5 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 5 5 5 5 5 5 5 5 5 5 5 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 5 5 4 5 5 5 5 5 5 5 5 4 4 5 5 5 5 5 5 5 5 5 ...
output:
98303 98303 98303 98303 98303
result:
ok 5 number(s): "98303 98303 98303 98303 98303"
Test #15:
score: 0
Accepted
time: 15ms
memory: 4828kb
input:
5 99999 63915 63915 63915 63915 38059 63915 63915 63915 25192 63915 1024 63915 63915 63915 63915 63915 63915 63915 63915 63896 63915 63915 14963 63915 63915 63915 52208 84889 63915 63915 63915 63915 63915 40674 63915 62258 63915 63915 63915 16744 63915 63915 63915 96429 91077 63915 63915 63915 43576...
output:
65535 83967 65535 98303 57343
result:
ok 5 number(s): "65535 83967 65535 98303 57343"
Test #16:
score: 0
Accepted
time: 5ms
memory: 4448kb
input:
500 999 324 675 675 324 675 675 675 675 675 324 675 324 675 324 324 675 324 675 675 675 324 675 324 675 324 675 324 675 324 675 675 324 675 675 675 675 675 324 675 324 675 675 675 675 324 324 675 675 324 324 675 675 324 675 675 675 324 675 324 675 675 675 675 675 675 675 675 675 675 675 675 324 675 ...
output:
999 551 287 639 767 735 511 511 511 783 511 639 703 991 895 879 511 511 511 415 471 503 959 511 511 831 383 511 767 511 103 895 990 767 759 255 767 639 469 959 511 447 703 511 511 895 959 511 959 703 255 879 815 767 975 991 895 983 983 767 987 255 767 511 703 511 860 927 735 511 831 991 767 855 127 ...
result:
ok 500 numbers
Test #17:
score: 0
Accepted
time: 8ms
memory: 4484kb
input:
50 10000 3548 5617 5617 3548 3548 1832 5617 5617 5617 3548 5617 5617 3548 5617 4445 3548 3548 3548 3548 5617 3548 5617 5617 5617 3548 3548 3548 5617 3548 5617 5617 3548 3548 5617 4470 3548 3548 5617 5617 5617 5617 5617 3548 5617 5617 3339 5617 3548 3548 6761 3548 3548 5617 3548 5617 5617 3548 3548 3...
output:
8191 4095 9343 9711 6143 6143 8191 6143 9939 5631 7487 8191 9215 9215 9215 8191 8191 8191 1535 8191 7679 7167 6142 8188 2047 9855 9215 6143 7999 9654 4095 7791 9263 6143 9215 5375 8382 9215 4095 7623 8191 8191 6143 3327 8063 7167 7167 4095 8191 8191
result:
ok 50 numbers
Test #18:
score: 0
Accepted
time: 11ms
memory: 4388kb
input:
500 999 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 ...
output:
999 551 287 639 767 735 511 511 511 783 511 639 703 991 895 879 511 511 511 415 471 503 959 511 511 831 383 511 767 511 103 895 990 767 759 255 767 639 469 959 511 447 703 511 511 895 959 511 959 703 255 879 815 767 975 991 895 983 983 767 987 255 767 511 703 511 860 927 735 511 831 991 767 855 127 ...
result:
ok 500 numbers
Extra Test:
score: 0
Extra Test Passed