QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#202722#2479. Rescue Missionnameless_story#AC ✓9ms4032kbC++20649b2023-10-06 13:12:012023-10-06 13:12:02

Judging History

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

  • [2023-10-06 13:12:02]
  • 评测
  • 测评结果:AC
  • 用时:9ms
  • 内存:4032kb
  • [2023-10-06 13:12:01]
  • 提交

answer

#include"bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(),(x).end()
template<class T1,class T2> bool cmin(T1 &x,const T2 &y) { if (y<x) { x=y; return 1; }return 0; }
template<class T1,class T2> bool cmax(T1 &x,const T2 &y) { if (x<y) { x=y; return 1; }return 0; }
int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	int n; cin>>n;
	vector<int> a(n),b(n),vis(20);
	for (int &x:a) cin>>x;
	int s=0;
	vis[s]=n;
	for (int i=n-1; i>=0; --i)
	{
		s+=a[i];
		s%=10;
		if (vis[s])
		{
			b[i]=vis[s]-i;
		}
		else
		{
			b[i]=-1;
		}
		vis[s]=i;
	}
	for (int i=0; i<n; ++i)
	{
		cout<<b[i]<<" \n"[i==n-1];
	}
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3804kb

input:

5
0 2 4 6 8

output:

1 4 2 -1 -1

result:

ok single line: '1 4 2 -1 -1'

Test #2:

score: 0
Accepted
time: 4ms
memory: 3844kb

input:

100000
0 7 9 5 5 5 7 3 5 5 3 6 2 0 3 4 2 8 1 2 0 3 2 4 3 8 7 8 4 7 5 9 9 4 3 3 1 5 6 5 6 4 9 9 5 2 5 3 0 2 0 8 7 8 3 9 1 9 4 4 1 2 4 0 3 1 9 0 3 8 1 6 0 8 5 5 9 2 7 5 8 5 2 0 3 2 3 5 5 9 2 0 0 9 5 9 2 0 5 3 0 3 3 0 5 2 7 4 9 9 8 8 3 0 4 9 3 8 9 9 4 6 4 1 5 4 2 8 4 0 9 0 5 7 8 1 9 9 6 6 5 2 8 2 4 4 8...

output:

1 11 21 2 2 4 2 23 2 35 7 14 7 1 6 7 2 7 9 60 1 5 12 5 5 16 6 28 10 4 5 8 5 3 46 5 9 22 5 7 2 31 5 18 10 3 4 6 1 3 1 12 25 3 6 2 2 5 13 15 5 5 7 1 14 2 4 1 40 22 5 11 1 24 2 15 20 50 3 4 6 4 5 1 28 3 16 2 7 5 25 1 1 6 9 10 4 1 12 18 1 6 4 1 37 8 3 4 8 11 24 20 12 1 15 3 3 4 15 28 2 2 3 3 18 24 2 11 ...

result:

ok single line: '1 11 21 2 2 4 2 23 2 35 7 14 7...1 5 5 5 5 -1 4 -1 -1 -1 -1 1 -1'

Test #3:

score: 0
Accepted
time: 4ms
memory: 4012kb

input:

100000
9 6 7 7 1 3 6 9 4 0 8 8 6 3 2 7 2 8 8 0 4 4 0 2 5 0 4 4 6 3 6 2 7 4 3 9 6 0 4 4 0 2 0 5 4 2 3 9 1 0 9 0 8 2 5 4 1 1 2 2 5 4 8 0 4 2 7 4 5 1 0 1 9 0 4 4 0 3 5 6 0 7 4 2 3 2 1 9 5 5 9 3 4 3 2 2 6 5 3 8 4 5 3 2 0 5 8 6 7 4 4 6 1 1 1 2 3 4 7 7 9 1 5 9 5 4 7 1 1 8 8 6 8 6 9 1 0 2 3 7 9 5 5 7 8 5 7...

output:

5 3 32 6 3 6 21 8 4 1 12 51 5 6 14 10 2 4 12 1 4 14 1 8 8 1 33 2 8 8 18 14 14 7 22 9 3 1 4 8 1 14 1 37 19 20 7 2 3 1 8 1 2 13 3 5 12 4 21 17 7 23 7 1 35 7 17 3 7 13 1 2 6 1 12 23 1 8 9 14 1 11 9 13 5 23 2 8 2 11 23 3 15 35 3 19 15 4 4 4 9 3 4 14 1 5 10 8 11 11 2 20 12 10 4 20 5 12 26 7 2 4 5 29 8 16...

result:

ok single line: '5 3 32 6 3 6 21 8 4 1 12 51 5 ...1 1 -1 -1 2 6 7 -1 1 -1 2 -1 -1'

Test #4:

score: 0
Accepted
time: 4ms
memory: 3948kb

input:

100000
7 6 9 5 5 4 6 3 3 8 0 2 5 3 1 7 5 2 8 6 1 1 2 9 6 8 1 3 2 0 7 4 9 5 6 7 0 9 7 5 2 2 2 4 9 7 6 8 7 2 0 2 2 4 5 5 0 0 3 9 4 4 2 9 7 1 9 2 7 2 7 7 4 1 3 6 1 7 0 2 9 8 5 5 5 0 9 8 5 3 0 5 1 0 2 7 7 1 8 9 5 9 9 7 1 5 7 6 6 0 6 7 1 8 3 7 5 3 4 3 2 6 5 8 2 5 2 0 6 7 2 5 2 8 8 8 4 5 6 5 8 3 6 8 5 9 2...

output:

53 3 11 2 11 2 4 19 12 3 1 3 12 14 7 7 9 2 24 4 11 7 18 9 5 24 13 7 8 1 3 7 3 19 9 6 1 8 26 26 4 6 27 3 4 5 20 8 11 5 1 9 30 8 2 23 1 1 4 13 3 10 6 32 11 2 4 7 25 4 13 10 36 3 3 14 4 10 1 20 18 7 2 2 6 1 6 15 9 25 1 9 4 1 12 17 5 20 5 6 4 8 19 4 11 6 35 17 5 1 8 40 17 6 2 7 15 3 5 23 7 12 4 2 15 5 9...

result:

ok single line: '53 3 11 2 11 2 4 19 12 3 1 3 1... 8 -1 -1 3 -1 2 -1 -1 4 1 -1 -1'

Test #5:

score: 0
Accepted
time: 4ms
memory: 3852kb

input:

100000
0 1 2 1 9 9 5 3 9 4 7 6 2 7 8 0 6 2 8 4 8 0 5 0 3 6 9 8 0 1 0 1 9 6 5 2 0 6 8 7 9 9 2 5 3 2 5 3 3 7 7 4 9 5 9 6 9 1 7 4 8 2 4 8 1 4 0 9 7 0 5 6 1 1 2 6 1 0 6 3 8 7 3 3 4 5 4 6 4 4 7 5 6 7 7 3 3 8 6 2 8 4 1 6 5 0 6 4 3 7 3 8 9 8 8 2 3 8 6 3 7 1 0 9 4 5 6 9 1 0 1 9 4 6 0 1 1 4 6 4 9 2 6 6 2 5 3...

output:

1 7 16 2 23 5 22 33 3 8 5 28 11 36 12 1 4 2 3 6 10 1 51 1 12 9 16 5 1 9 1 2 3 33 21 22 1 4 6 15 3 11 3 3 3 3 33 4 2 15 3 8 8 3 9 10 2 4 24 9 2 10 31 9 17 4 1 27 6 1 39 4 4 4 26 12 4 1 6 33 6 2 3 7 20 6 2 2 4 9 47 12 3 4 2 4 46 8 4 2 7 25 12 15 15 1 2 8 2 2 3 32 5 14 2 7 4 14 7 2 32 3 1 15 17 3 7 2 1...

result:

ok single line: '1 7 16 2 23 5 22 33 3 8 5 28 1...7 -1 6 1 -1 -1 -1 2 3 3 -1 2 -1'

Test #6:

score: 0
Accepted
time: 4ms
memory: 3920kb

input:

100000
0 1 3 9 9 6 7 5 9 8 1 2 9 3 6 7 6 8 7 8 8 6 7 0 3 9 3 4 5 8 0 8 5 3 0 2 5 1 6 2 5 7 8 7 7 3 5 1 0 0 1 0 3 6 9 8 7 4 4 9 5 3 1 2 0 0 1 0 4 9 4 2 9 9 7 0 6 6 3 0 2 4 2 1 8 3 7 1 4 1 3 5 7 9 7 0 4 8 3 5 3 6 1 5 2 6 3 4 1 5 7 2 8 0 7 5 6 7 9 8 8 7 7 6 4 1 9 6 7 0 1 9 2 3 1 0 1 3 1 6 3 7 8 1 8 5 0...

output:

1 7 15 17 30 9 5 9 4 4 16 4 15 5 7 7 7 21 11 25 8 27 3 1 8 36 4 6 13 11 1 8 4 4 1 10 31 21 4 51 3 18 5 13 2 6 7 8 1 1 4 1 8 4 9 7 13 24 24 5 13 9 16 8 1 1 6 1 9 6 25 3 7 11 9 1 33 15 7 1 6 8 9 5 15 2 21 7 5 29 12 7 13 4 7 1 4 48 35 5 3 5 44 5 8 14 5 3 7 8 25 2 4 1 7 7 4 14 8 4 14 3 7 2 4 2 40 10 23 ...

result:

ok single line: '1 7 15 17 30 9 5 9 4 4 16 4 15... 7 -1 3 -1 2 -1 -1 5 -1 2 -1 -1'

Test #7:

score: 0
Accepted
time: 8ms
memory: 3888kb

input:

100000
7 1 5 6 4 5 9 5 4 5 9 9 9 9 4 4 0 3 9 7 8 1 7 8 8 5 6 3 5 1 2 6 4 8 4 4 3 1 1 8 8 8 0 5 4 5 7 9 3 5 3 2 1 7 9 5 2 2 8 8 2 6 2 3 2 6 0 4 2 2 2 4 3 1 5 3 6 5 6 5 1 9 8 9 8 4 7 0 3 1 2 9 4 8 6 1 4 8 3 1 7 1 8 5 0 1 5 2 7 9 8 1 7 5 6 5 9 6 9 0 9 9 7 0 6 1 8 3 8 8 2 9 5 0 9 9 2 1 9 2 7 2 4 5 1 4 6...

output:

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

result:

ok single line: '11 6 4 2 8 17 7 7 13 16 5 12 2...2 7 -1 3 5 2 -1 6 4 -1 -1 -1 -1'

Test #8:

score: 0
Accepted
time: 4ms
memory: 3936kb

input:

100000
7 3 1 2 1 4 1 5 9 7 9 5 8 6 4 2 3 1 6 1 3 8 2 1 3 6 1 4 7 2 8 6 1 6 2 9 7 0 9 6 8 9 3 5 8 3 7 8 9 4 7 7 0 5 4 6 3 4 6 3 5 9 8 9 4 5 8 7 4 2 9 8 4 4 5 3 1 5 1 7 2 0 3 1 4 3 9 5 9 8 3 6 1 2 1 0 0 9 8 3 6 7 9 2 4 8 0 0 7 3 8 4 2 7 9 9 5 4 2 8 5 7 4 1 3 6 0 4 0 6 9 2 2 1 3 1 5 5 2 0 9 6 3 2 6 6 7...

output:

2 16 8 34 5 3 8 4 4 19 19 13 4 2 4 10 3 16 3 17 15 2 10 3 3 5 57 18 6 2 16 8 8 15 8 25 5 1 6 11 3 11 13 6 30 2 11 7 3 9 11 12 1 16 2 12 6 2 6 44 6 4 14 10 6 3 5 5 9 35 5 7 8 17 50 4 8 11 3 7 5 1 5 22 5 17 6 29 3 5 3 4 9 6 4 1 1 3 23 15 13 5 7 43 7 7 1 1 2 24 5 7 24 4 21 4 26 6 2 3 5 10 23 3 8 3 1 3 ...

result:

ok single line: '2 16 8 34 5 3 8 4 4 19 19 13 4...3 1 3 8 -1 3 3 -1 2 -1 -1 -1 -1'

Test #9:

score: 0
Accepted
time: 8ms
memory: 3876kb

input:

100000
1 1 1 0 1 6 7 5 8 5 1 7 5 1 6 0 2 4 9 4 7 8 6 5 3 7 6 8 4 2 9 1 0 6 2 5 5 2 4 5 0 8 3 3 9 0 5 8 9 0 0 1 8 3 7 0 5 7 5 2 5 1 4 3 1 8 4 2 3 3 3 9 4 0 2 5 6 1 5 4 8 7 9 1 6 8 1 2 8 4 9 8 1 3 3 5 6 6 7 8 1 2 1 7 3 2 8 5 0 5 4 3 2 4 9 1 2 3 5 9 5 0 5 6 0 7 3 7 1 8 6 0 6 9 3 2 7 8 1 2 4 8 3 8 4 5 3...

output:

6 17 6 1 8 15 3 10 37 10 5 16 13 16 8 1 7 25 3 5 8 58 9 25 2 11 4 7 11 6 2 9 1 5 20 2 8 20 5 10 1 30 5 16 9 1 14 14 4 1 1 15 6 2 11 1 13 5 6 9 3 27 5 10 13 5 9 5 14 12 8 5 19 1 40 11 7 3 7 27 7 14 2 7 10 7 11 2 5 11 13 5 9 6 4 16 6 11 46 19 29 3 11 2 8 2 9 3 1 8 21 19 9 71 2 5 3 9 6 24 3 1 15 18 1 2...

result:

ok single line: '6 17 6 1 8 15 3 10 37 10 5 16 ...-1 10 7 1 -1 1 -1 -1 -1 3 -1 -1'

Test #10:

score: 0
Accepted
time: 8ms
memory: 3852kb

input:

100000
9 4 1 8 7 5 4 5 4 1 9 0 9 5 0 8 3 4 5 5 6 7 0 7 8 4 3 7 1 1 2 4 7 1 9 0 5 3 6 6 8 3 6 2 2 7 1 1 6 5 6 1 5 0 3 2 5 2 6 0 5 6 7 4 6 8 6 2 2 5 5 3 0 4 5 1 0 4 3 5 8 5 2 6 3 0 3 3 7 8 4 8 2 2 3 9 1 9 2 8 9 1 5 6 2 7 5 4 9 9 3 2 1 4 7 1 0 2 1 5 2 1 5 2 3 8 3 1 7 8 8 3 0 4 4 6 7 1 4 9 7 9 7 5 2 9 1...

output:

30 4 6 3 13 11 19 3 25 2 16 1 27 5 1 4 6 4 2 8 4 10 1 6 8 9 2 11 9 20 13 13 21 2 8 1 4 21 3 35 8 5 3 8 3 5 6 16 24 6 9 15 4 1 3 6 49 7 10 1 31 24 8 2 3 10 3 17 14 2 10 8 1 3 4 12 1 4 23 4 8 22 14 7 10 1 9 2 22 3 9 2 23 29 15 2 2 7 2 13 2 7 4 4 19 8 5 9 32 10 4 28 23 7 4 11 1 4 9 9 4 8 3 8 6 13 6 17 ...

result:

ok single line: '30 4 6 3 13 11 19 3 25 2 16 1 ...6 1 -1 -1 8 -1 -1 -1 -1 -1 1 -1'

Test #11:

score: 0
Accepted
time: 8ms
memory: 3868kb

input:

100000
6 6 7 6 4 7 5 1 0 7 3 9 7 9 7 5 0 0 1 0 4 4 0 3 5 7 1 2 7 7 9 6 3 1 3 7 8 9 4 2 0 2 5 8 5 3 0 2 4 3 7 8 5 6 6 9 7 6 4 3 8 8 2 9 0 7 7 0 4 5 3 8 3 4 0 8 2 9 6 4 6 3 6 3 5 1 6 6 0 9 5 3 5 2 5 6 2 6 4 2 7 3 7 1 8 7 4 2 2 7 8 2 9 7 3 7 8 1 8 2 1 7 4 4 4 4 5 5 3 5 0 3 2 5 5 2 2 5 9 3 4 3 5 1 5 4 9...

output:

19 5 6 2 28 5 19 5 1 2 6 24 12 9 23 6 1 1 13 1 10 6 1 10 25 3 3 15 10 32 9 3 14 25 2 5 7 7 17 15 1 4 8 9 4 12 1 9 35 2 3 11 14 48 15 12 4 2 13 5 10 2 14 11 1 13 7 1 4 15 15 8 14 44 1 2 6 19 2 2 7 7 16 7 9 7 22 4 1 20 5 3 5 13 29 5 9 2 16 5 2 2 27 4 6 6 12 6 16 10 2 45 20 2 2 11 5 10 2 3 5 16 18 7 14...

result:

ok single line: '19 5 6 2 28 5 19 5 1 2 6 24 12...5 1 5 6 -1 -1 2 -1 5 2 -1 -1 -1'

Test #12:

score: 0
Accepted
time: 8ms
memory: 3840kb

input:

100000
9 2 6 4 8 3 9 5 8 4 6 1 5 6 6 1 4 0 3 5 6 7 2 8 9 8 7 8 0 9 1 3 8 2 3 7 4 9 6 6 9 9 2 1 6 2 0 6 8 4 4 5 3 0 8 9 3 8 8 8 5 4 6 2 6 5 2 5 4 1 6 3 2 1 8 0 2 1 0 1 5 0 4 0 9 8 4 7 6 9 6 7 8 2 2 9 0 5 4 0 2 3 4 1 4 6 8 3 4 6 3 1 3 0 7 9 2 8 7 7 2 0 5 4 7 7 0 2 1 5 5 4 3 1 7 0 5 8 8 8 7 6 6 9 9 5 2...

output:

13 4 2 14 3 25 9 14 6 2 12 41 8 6 21 12 16 1 7 4 6 12 2 5 16 12 19 12 1 2 14 31 2 16 2 3 12 4 4 34 3 5 19 21 7 5 1 6 11 11 5 15 4 1 3 3 9 14 22 15 7 2 7 5 25 13 37 3 30 3 5 19 9 15 3 1 10 8 1 4 7 1 10 1 21 6 10 15 7 4 51 35 2 14 5 6 1 11 19 1 4 38 7 21 2 6 15 6 2 3 9 5 3 1 6 8 2 8 16 11 24 1 10 5 19...

result:

ok single line: '13 4 2 14 3 25 9 14 6 2 12 41 ...-1 -1 -1 2 -1 1 6 2 -1 -1 -1 -1'

Test #13:

score: 0
Accepted
time: 9ms
memory: 3836kb

input:

100000
2 3 9 5 2 5 0 3 3 1 3 1 7 0 0 8 1 0 7 5 7 5 4 9 0 4 8 0 7 2 9 2 0 5 3 9 6 9 8 0 0 5 5 6 8 3 2 1 6 1 3 6 7 2 2 4 9 5 2 9 1 9 7 8 2 7 4 7 1 3 1 3 3 4 0 0 8 5 4 2 7 0 5 2 0 1 3 6 7 1 7 6 3 0 8 7 1 4 9 0 0 4 9 0 0 3 0 5 7 6 0 7 8 7 9 3 4 6 3 6 3 3 1 2 3 3 1 9 6 8 9 3 2 9 1 4 9 1 9 0 3 8 1 7 6 7 7...

output:

19 8 18 10 4 18 1 4 21 7 7 34 10 1 1 11 5 1 38 5 17 6 12 7 1 6 12 1 4 7 17 4 1 6 8 61 10 16 31 1 1 2 12 5 5 22 4 25 3 3 5 6 8 10 4 4 8 9 12 2 2 22 9 2 4 14 20 10 27 4 10 3 6 8 1 1 13 14 6 8 23 1 17 7 1 3 6 6 9 13 25 26 17 1 4 18 10 23 10 1 1 20 8 1 1 17 1 7 4 7 1 12 7 12 10 16 2 9 11 31 29 12 5 13 6...

result:

ok single line: '19 8 18 10 4 18 1 4 21 7 7 34 ... 1 5 7 -1 8 -1 1 1 -1 1 3 -1 -1'

Test #14:

score: 0
Accepted
time: 8ms
memory: 3848kb

input:

100000
9 5 2 4 6 2 7 9 5 5 6 4 1 2 1 5 0 0 8 8 3 3 3 3 5 1 1 9 8 0 9 8 7 2 2 2 6 2 7 8 0 6 5 6 4 6 1 5 4 0 2 9 0 4 8 0 5 5 6 2 2 0 1 2 2 2 4 9 1 3 5 0 0 1 2 6 2 3 0 3 8 4 2 1 6 2 3 7 6 0 7 2 5 4 4 3 7 5 7 8 0 7 6 5 7 9 7 1 5 1 0 2 3 0 3 7 9 1 0 0 3 3 2 0 6 8 8 6 0 4 1 0 1 4 6 1 3 3 7 8 5 2 1 1 2 6 8...

output:

4 8 6 2 7 20 9 6 2 11 2 28 19 9 12 8 1 1 17 5 13 11 7 4 10 22 2 13 23 1 6 11 38 10 3 3 8 11 19 15 1 14 17 2 2 18 3 5 16 1 16 20 1 7 21 1 2 8 3 21 16 1 6 4 14 24 19 2 6 15 11 1 1 13 3 12 6 6 1 15 42 11 25 13 22 10 2 4 5 1 14 7 10 6 21 2 7 3 7 9 1 11 7 10 6 21 25 16 9 16 1 34 40 1 2 6 2 21 1 1 7 15 6 ...

result:

ok single line: '4 8 6 2 7 20 9 6 2 11 2 28 19 ... 10 5 1 -1 -1 -1 -1 -1 -1 -1 -1'

Test #15:

score: 0
Accepted
time: 4ms
memory: 3928kb

input:

100000
1 1 5 5 2 3 8 2 0 8 6 3 6 5 1 9 1 4 6 0 6 1 7 3 9 5 4 5 7 7 5 4 6 2 9 6 7 6 4 3 0 2 5 9 9 6 0 6 5 6 0 4 4 1 4 1 5 5 2 0 0 6 2 7 0 1 5 2 6 2 7 2 7 6 4 4 3 9 2 9 6 8 0 4 8 8 0 4 8 7 1 7 9 1 6 9 9 5 8 2 6 2 3 2 7 0 7 6 3 6 7 6 5 4 6 6 3 2 0 2 6 9 3 0 9 0 9 7 2 1 2 4 3 8 3 9 4 7 3 3 2 7 3 8 2 6 8...

output:

13 10 2 3 17 7 2 3 1 17 4 16 30 5 2 2 15 2 5 1 8 4 2 7 5 11 8 37 7 17 20 2 5 5 11 24 4 2 31 4 1 21 7 5 9 22 1 8 6 3 1 26 4 31 3 18 2 11 5 1 1 11 4 8 1 14 44 3 6 28 6 11 9 2 4 15 19 3 33 13 13 4 1 3 4 4 1 4 11 7 14 23 2 5 9 12 5 15 2 3 5 8 20 15 4 1 7 34 12 7 27 6 20 2 28 10 12 4 1 4 26 6 7 1 7 1 25 ...

result:

ok single line: '13 10 2 3 17 7 2 3 1 17 4 16 3...-1 -1 7 -1 8 3 4 -1 -1 -1 -1 -1'

Test #16:

score: 0
Accepted
time: 8ms
memory: 4012kb

input:

100000
4 2 9 1 2 7 5 8 6 7 4 5 7 7 2 6 0 6 6 5 7 8 5 2 6 7 0 9 9 8 8 2 1 7 2 9 1 5 1 6 3 9 4 1 6 5 5 7 8 4 1 8 5 9 5 2 6 1 8 7 8 6 8 8 9 5 6 7 7 5 2 5 8 3 1 8 2 5 7 4 3 4 4 0 3 0 8 8 0 6 7 5 1 9 7 9 0 3 3 7 3 9 9 6 4 2 2 0 4 1 7 9 6 7 2 7 5 6 9 4 8 1 3 5 8 2 0 9 0 7 9 1 5 6 8 5 9 0 9 8 0 1 8 6 6 3 3...

output:

7 8 2 3 11 3 5 5 10 5 14 27 18 12 5 6 1 12 13 3 3 18 4 13 9 29 1 15 24 11 2 3 3 25 9 2 8 9 3 21 8 4 8 10 15 2 3 4 7 8 6 14 16 10 17 17 5 5 25 19 4 14 4 29 3 5 3 12 6 4 25 11 4 7 7 2 11 8 15 11 8 10 16 1 39 1 10 20 1 10 19 21 2 9 9 21 1 7 2 2 10 5 11 2 7 10 11 1 22 5 11 14 22 7 4 7 3 36 6 9 27 12 85 ...

result:

ok single line: '7 8 2 3 11 3 5 5 10 5 14 27 18... -1 -1 -1 2 -1 4 2 -1 2 2 -1 -1'

Test #17:

score: 0
Accepted
time: 8ms
memory: 3888kb

input:

100000
7 7 0 4 4 0 1 5 9 5 4 6 4 4 4 9 6 5 5 2 6 2 8 1 1 6 8 1 9 8 8 1 6 4 7 3 1 3 8 3 9 5 1 2 2 5 1 2 8 4 9 6 0 6 5 7 7 4 3 2 0 8 9 2 2 0 2 6 6 9 9 6 3 1 4 8 3 9 7 1 1 2 1 4 0 2 0 3 8 7 9 9 2 0 1 7 9 6 6 1 3 6 5 1 0 9 3 1 7 3 2 9 0 8 5 5 3 9 4 2 1 0 8 7 1 7 2 7 4 9 2 7 7 2 6 3 7 8 2 3 2 8 8 9 7 8 5...

output:

14 8 1 12 4 1 4 9 16 12 2 2 27 20 18 3 11 2 10 3 10 2 3 12 34 6 14 2 10 22 7 11 2 34 2 21 7 22 3 5 14 4 4 4 4 5 6 2 16 6 7 9 1 28 19 8 14 8 11 3 1 36 15 12 4 1 26 4 4 7 9 3 11 18 10 3 4 5 25 16 6 8 6 38 1 5 1 28 16 9 3 8 4 1 6 29 12 10 3 3 11 18 10 3 1 4 17 7 2 11 18 6 1 5 2 10 17 15 8 12 15 1 21 47...

result:

ok single line: '14 8 1 12 4 1 4 9 16 12 2 2 27...1 2 6 -1 2 -1 4 -1 -1 4 -1 1 -1'

Test #18:

score: 0
Accepted
time: 8ms
memory: 3848kb

input:

100000
3 8 6 3 1 4 3 6 6 5 4 3 9 8 8 2 8 0 1 1 8 6 0 3 9 6 1 1 7 4 8 7 4 1 9 1 8 8 5 3 4 8 4 6 3 9 0 6 1 8 7 6 3 1 1 9 6 9 2 2 4 9 7 9 2 7 7 0 0 2 4 9 4 6 4 1 8 1 9 5 0 1 8 1 5 4 2 4 6 1 9 1 0 0 7 3 9 7 8 4 4 6 3 8 1 5 7 5 1 6 8 2 1 9 6 8 4 4 5 5 4 4 5 2 5 5 9 2 7 8 0 6 5 9 3 2 3 5 3 1 2 7 6 3 8 3 5...

output:

4 21 3 12 5 8 4 12 22 20 15 3 15 13 2 2 4 1 3 21 12 29 1 5 38 14 33 4 5 9 4 6 17 2 2 10 7 4 4 16 8 5 2 8 8 8 1 17 19 9 11 3 5 7 2 46 9 13 40 7 3 12 15 9 18 6 14 1 1 7 13 32 2 2 16 3 30 2 21 6 1 3 5 3 16 3 9 2 44 2 2 6 1 1 2 13 9 7 20 11 2 6 7 16 19 10 7 4 22 7 2 6 2 24 8 6 17 11 2 5 5 6 18 6 2 16 23...

result:

ok single line: '4 21 3 12 5 8 4 12 22 20 15 3 ...1 -1 -1 7 3 -1 2 2 3 -1 -1 2 -1'

Test #19:

score: 0
Accepted
time: 8ms
memory: 3896kb

input:

100000
0 1 9 8 1 4 7 5 0 7 7 3 7 6 8 0 3 7 3 8 4 9 6 0 0 1 6 7 3 1 5 3 5 1 1 3 6 6 9 2 4 4 0 7 7 8 5 5 3 8 1 1 9 1 3 3 5 2 8 7 5 9 3 7 4 5 2 0 3 9 9 8 2 7 6 2 5 7 8 8 5 4 6 7 0 9 4 8 6 6 9 9 0 4 1 2 5 6 3 7 7 3 9 0 3 0 0 9 5 3 1 2 0 3 6 4 2 8 7 5 0 3 7 2 8 5 9 7 7 6 1 4 9 4 0 7 0 1 9 8 9 1 6 2 5 0 6...

output:

1 2 28 4 17 6 9 20 1 5 2 2 28 19 20 1 2 2 5 12 6 34 6 1 1 25 7 2 16 10 8 4 4 12 3 6 35 12 18 3 6 16 1 20 3 6 2 15 27 3 10 2 2 23 34 3 9 2 3 7 26 6 2 7 8 4 8 1 46 13 25 2 9 4 4 5 3 17 13 5 16 2 7 4 1 23 12 3 4 39 7 8 1 12 15 6 7 43 2 42 2 16 9 1 6 1 1 5 7 23 14 11 1 6 2 12 2 3 11 7 1 2 21 2 10 13 5 3...

result:

ok single line: '1 2 28 4 17 6 9 20 1 5 2 2 28 ...2 -1 3 -1 3 -1 5 -1 -1 -1 -1 -1'

Test #20:

score: 0
Accepted
time: 5ms
memory: 3840kb

input:

100000
0 0 7 6 8 4 2 3 6 5 0 8 2 0 7 4 7 4 3 9 9 4 0 8 0 9 8 9 3 9 3 1 8 9 7 6 4 1 7 0 5 0 4 1 6 7 4 8 7 6 3 1 6 1 4 8 4 0 1 5 6 2 0 9 3 9 9 7 0 0 0 7 3 0 0 4 1 8 4 4 0 6 8 7 0 7 9 1 5 1 4 2 1 9 4 6 6 3 9 5 8 7 4 3 9 7 6 9 8 0 5 1 7 2 8 4 1 8 2 1 5 0 4 8 7 9 2 3 9 2 6 2 1 0 9 7 5 4 5 4 0 2 1 6 1 8 0...

output:

1 1 6 4 14 5 14 24 31 10 1 2 5 1 37 7 12 26 9 5 6 9 1 9 1 8 3 11 7 5 57 16 4 12 7 2 14 12 8 1 4 1 6 11 22 14 9 14 9 3 3 5 52 11 8 17 4 1 28 9 5 19 1 4 20 12 10 11 1 1 1 2 7 1 1 23 13 6 25 3 1 11 15 7 1 8 2 20 3 11 5 8 2 8 2 10 16 11 13 3 20 5 19 14 36 4 10 6 18 1 34 3 6 2 48 10 12 2 6 4 26 1 5 7 5 1...

result:

ok single line: '1 1 6 4 14 5 14 24 31 10 1 2 5...2 1 -1 1 1 -1 2 3 -1 -1 -1 -1 1'

Test #21:

score: 0
Accepted
time: 8ms
memory: 4012kb

input:

100000
8 3 0 5 8 6 6 5 3 2 7 7 1 1 5 6 0 8 7 3 1 9 9 8 8 8 3 9 8 0 3 9 3 5 6 9 6 8 5 4 6 0 9 4 2 2 7 5 7 5 3 5 9 1 7 4 2 4 1 6 5 0 9 3 6 1 4 4 1 5 8 1 1 2 0 9 4 7 7 3 3 9 5 1 3 8 0 7 5 2 8 2 7 3 3 6 4 3 1 9 5 0 6 1 4 5 1 4 4 1 8 7 9 8 9 1 8 2 4 4 4 1 7 5 9 8 6 6 1 1 5 9 7 3 5 8 9 0 1 7 8 4 7 9 2 6 5...

output:

6 18 1 5 3 4 6 3 5 17 15 5 11 5 7 12 1 21 2 5 2 19 22 12 15 3 3 4 4 1 4 12 21 3 15 22 14 9 7 2 7 1 14 5 16 23 13 4 4 6 17 34 2 8 17 3 8 19 7 4 14 1 43 3 8 4 35 3 14 8 3 17 7 11 1 3 10 4 2 4 13 9 14 41 27 4 1 11 7 2 2 13 2 6 37 2 18 22 2 4 9 1 11 3 3 3 4 8 4 24 7 19 10 8 2 28 2 3 5 6 7 5 14 9 5 3 11 ...

result:

ok single line: '6 18 1 5 3 4 6 3 5 17 15 5 11 ... 2 5 5 -1 8 3 3 -1 2 -1 3 -1 -1'

Test #22:

score: 0
Accepted
time: 7ms
memory: 3912kb

input:

100000
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

27001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok single line: '27001 1 1 1 1 1 1 1 1 1 1 1 1 ...1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1'

Test #23:

score: 0
Accepted
time: 7ms
memory: 3840kb

input:

100000
3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

27001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok single line: '27001 1 1 1 1 1 1 1 1 1 1 1 1 ...1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1'

Test #24:

score: 0
Accepted
time: 7ms
memory: 3884kb

input:

100000
9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

27001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok single line: '27001 1 1 1 1 1 1 1 1 1 1 1 1 ...1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1'

Test #25:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

5
5 5 5 0 5

output:

2 2 3 1 -1

result:

ok single line: '2 2 3 1 -1'

Test #26:

score: 0
Accepted
time: 7ms
memory: 3932kb

input:

100000
9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9...

output:

10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 ...

result:

ok single line: '10 10 10 10 10 10 10 10 10 10 ...0 10 -1 -1 -1 -1 -1 -1 -1 -1 -1'

Test #27:

score: 0
Accepted
time: 7ms
memory: 4012kb

input:

100000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok single line: '1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1'

Test #28:

score: 0
Accepted
time: 7ms
memory: 4032kb

input:

100000
1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

99992 99992 99992 99992 99992 99992 99992 99992 99992 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok single line: '99992 99992 99992 99992 99992 ... 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1'

Test #29:

score: 0
Accepted
time: 0ms
memory: 3572kb

input:

9
1 1 1 1 1 1 1 1 1

output:

-1 -1 -1 -1 -1 -1 -1 -1 -1

result:

ok single line: '-1 -1 -1 -1 -1 -1 -1 -1 -1'

Test #30:

score: 0
Accepted
time: 0ms
memory: 3636kb

input:

1
0

output:

1

result:

ok single line: '1'