QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#24977#1830. ANDWu_RenTL 156ms3684kbC++17404b2022-04-03 11:27:052022-04-30 06:57:54

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-04-30 06:57:54]
  • 评测
  • 测评结果:TL
  • 用时:156ms
  • 内存:3684kb
  • [2022-04-03 11:27:05]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int T,n,a[100010];
void sol(){
	cin>>n;
	int And=(1<<20)-1;
	for(int i=0;i<n;i++) cin>>a[i],And&=a[i];
	bool fl=0;
	for(int i=0;i<n;i++) if(a[i]==And) fl=1;
	if(!fl) return cout<<"-1\n",void();
	cout<<2*n<<"\n";
	for(int i=0;i<n;i++) cout<<a[i]<<" "<<And<<" ";cout<<"\n";
}
int main(){
	ios::sync_with_stdio(0);
	cin>>T;
	while(T--) sol();
}

詳細信息

Test #1:

score: 100
Accepted
time: 3ms
memory: 3684kb

input:

3
1
5
3
0 1 2
2
1 2

output:

2
5 5 
6
0 0 1 0 2 0 
-1

result:

ok answer is correct (3 test cases)

Test #2:

score: 0
Accepted
time: 66ms
memory: 3604kb

input:

20000
5
16 13 5 15 20
5
11 0 13 2 17
5
13 12 8 10 18
5
1 8 16 19 5
5
9 12 3 10 13
5
7 0 14 3 16
5
10 3 9 11 6
5
1 0 4 18 14
5
1 10 5 9 12
5
10 18 16 20 17
5
7 8 19 6 1
5
18 7 4 5 12
5
17 4 6 11 7
5
1 0 12 2 15
5
0 15 7 5 4
5
16 3 4 10 14
5
16 0 2 18 14
5
0 16 20 5 3
5
8 9 10 4 6
5
19 2 12 20 13
5
16...

output:

-1
10
11 0 0 0 13 0 2 0 17 0 
-1
-1
-1
10
7 0 0 0 14 0 3 0 16 0 
-1
10
1 0 0 0 4 0 18 0 14 0 
-1
-1
-1
-1
-1
10
1 0 0 0 12 0 2 0 15 0 
10
0 0 15 0 7 0 5 0 4 0 
-1
10
16 0 0 0 2 0 18 0 14 0 
10
0 0 16 0 20 0 5 0 3 0 
-1
-1
-1
-1
-1
-1
-1
-1
10
12 0 19 0 0 0 10 0 17 0 
-1
10
13 0 15 0 0 0 17 0 10 0 
-...

result:

ok answer is correct (20000 test cases)

Test #3:

score: 0
Accepted
time: 65ms
memory: 3468kb

input:

20000
5
9 28 1 21 4
5
21 22 23 9 27
5
24 19 1 29 4
5
8 29 5 3 22
5
6 8 28 7 25
5
30 23 24 29 7
5
8 6 29 26 3
5
20 13 2 8 22
5
10 5 30 8 27
5
15 29 0 11 24
5
14 28 16 18 22
5
12 16 20 21 14
5
15 6 24 21 0
5
22 11 28 30 17
5
10 23 11 18 21
5
18 3 7 27 15
5
25 0 4 13 14
5
27 12 30 11 18
5
4 10 0 17 24
...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
10
15 0 29 0 0 0 11 0 24 0 
-1
-1
10
15 0 6 0 24 0 21 0 0 0 
-1
-1
-1
10
25 0 0 0 4 0 13 0 14 0 
-1
10
4 0 10 0 0 0 17 0 24 0 
-1
-1
10
4 0 9 0 0 0 7 0 2 0 
10
0 0 30 0 27 0 26 0 3 0 
-1
-1
-1
10
21 0 6 0 12 0 25 0 0 0 
10
21 0 0 0 11 0 14 0 10 0 
-1
-1
10
10 0 26 0 17 0 1...

result:

ok answer is correct (20000 test cases)

Test #4:

score: 0
Accepted
time: 36ms
memory: 3600kb

input:

10000
10
18 30 2 8 15 6 3 12 24 17
10
25 19 2 26 29 8 16 18 4 24
10
30 14 27 24 23 18 5 16 4 17
10
30 29 9 8 3 23 13 16 5 11
10
29 4 15 2 3 24 23 0 5 30
10
6 12 8 30 5 10 4 19 22 13
10
21 30 24 25 14 6 1 4 11 23
10
9 14 23 15 25 11 19 5 8 13
10
10 29 8 28 21 14 25 3 11 15
10
14 6 30 23 25 9 17 28 29...

output:

-1
-1
-1
-1
20
29 0 4 0 15 0 2 0 3 0 24 0 23 0 0 0 5 0 30 0 
-1
-1
-1
-1
-1
-1
20
10 0 0 0 5 0 6 0 9 0 17 0 19 0 26 0 30 0 1 0 
20
23 0 27 0 15 0 1 0 8 0 28 0 0 0 3 0 24 0 18 0 
20
24 0 16 0 17 0 14 0 28 0 7 0 1 0 5 0 11 0 0 0 
-1
-1
-1
-1
20
24 0 0 0 7 0 8 0 29 0 23 0 27 0 16 0 15 0 21 0 
-1
20
17 ...

result:

ok answer is correct (10000 test cases)

Test #5:

score: 0
Accepted
time: 156ms
memory: 3556kb

input:

50000
2
58 40
2
13 62
2
58 48
2
28 5
2
14 47
2
31 50
2
35 9
2
31 87
2
17 26
2
100 66
2
20 57
2
92 40
2
48 31
2
32 79
2
4 78
2
69 68
2
3 36
2
34 91
2
93 91
2
12 88
2
79 40
2
82 98
2
23 36
2
56 58
2
71 13
2
52 86
2
67 32
2
87 52
2
46 75
2
88 16
2
16 11
2
6 8
2
18 45
2
89 99
2
10 41
2
96 7
2
12 67
2
4 ...

output:

4
58 40 40 40 
-1
4
58 48 48 48 
-1
4
14 14 47 14 
-1
-1
-1
-1
-1
-1
-1
-1
-1
4
4 4 78 4 
4
69 68 68 68 
-1
-1
-1
-1
-1
-1
-1
4
56 56 58 56 
-1
-1
-1
-1
-1
4
88 16 16 16 
-1
-1
-1
-1
-1
-1
-1
4
4 4 61 4 
-1
-1
4
63 17 17 17 
-1
-1
4
8 8 30 8 
-1
-1
-1
-1
4
43 11 11 11 
-1
-1
-1
4
83 16 16 16 
-1
-1
...

result:

ok answer is correct (50000 test cases)

Test #6:

score: -100
Time Limit Exceeded

input:

100000
1
506023
1
837326
1
753172
1
328218
1
990879
1
218952
1
394008
1
1011923
1
227745
1
207269
1
840304
1
524657
1
656594
1
848736
1
860274
1
37615
1
593627
1
365335
1
289082
1
400301
1
878184
1
823563
1
9512
1
963056
1
54956
1
143268
1
1019230
1
9311
1
242652
1
986091
1
618563
1
74376
1
751535
1...

output:

2
506023 506023 
2
837326 837326 
2
753172 753172 
2
328218 328218 
2
990879 990879 
2
218952 218952 
2
394008 394008 
2
1011923 1011923 
2
227745 227745 
2
207269 207269 
2
840304 840304 
2
524657 524657 
2
656594 656594 
2
848736 848736 
2
860274 860274 
2
37615 37615 
2
593627 593627 
2
365335 36...

result: