QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#499720#8271. Sequencebachbeo2007100 ✓440ms37196kbC++231.2kb2024-07-31 17:52:522024-07-31 17:52:52

Judging History

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

  • [2024-07-31 17:52:52]
  • 评测
  • 测评结果:100
  • 用时:440ms
  • 内存:37196kb
  • [2024-07-31 17:52:52]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int maxn = 30005;
#define int long long
const int inf = 1e18;

int n,w[maxn];
vector<int> f[maxn];
map<vector<int>,int> mp;

int g(vector<int> x){
    if(x.empty()) return w[1]+w[2];
    if(mp.find(x)!=mp.end()) return mp[x];
    vector<int> c=x;
    int a=c.back();c.pop_back();

    int res=inf;
    for(int i:f[a]){
        int j=a/i;
        vector<int> nx=c;
        if(i>2) nx.push_back(i);
        if(j>2) nx.push_back(j);
        sort(nx.begin(),nx.end());
        nx.erase(unique(nx.begin(),nx.end()),nx.end());
        res=min(res,g(nx));
    }
    if(a>3) c.push_back(a-1);
    sort(c.begin(),c.end());
    c.erase(unique(c.begin(),c.end()),c.end());
    res=min(res,g(c));
    return mp[x]=res+w[a];
}

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cin >> n;
    for(int i=1;i<=n;i++) cin >> w[i];
    for(int i=2;i<=n;i++) for(int j=i*i;j<=n;j+=i) f[j].push_back(i);

    cout << w[1] << '\n';
    if(n>=2) cout << w[1]+w[2] << '\n';
    if(n<=2) return 0;
    for(int i=3;i<=n;i++) cout << g({i}) << '\n';
    cout << '\n';
}

詳細信息

Subtask #1:

score: 11
Accepted

Test #1:

score: 11
Accepted
time: 1ms
memory: 3544kb

input:

10
1
1
300
1
300
300
300
1
1
1

output:

1
2
302
3
303
602
902
4
5
6


result:

ok 10 lines

Test #2:

score: 11
Accepted
time: 0ms
memory: 3628kb

input:

5
2
3
5
8
11

output:

2
5
10
13
24


result:

ok 5 lines

Test #3:

score: 11
Accepted
time: 0ms
memory: 3528kb

input:

5
11
8
5
3
2

output:

11
19
24
22
24


result:

ok 5 lines

Test #4:

score: 11
Accepted
time: 0ms
memory: 3828kb

input:

10
923992
541947
567511
357324
813558
178420
173977
186266
158267
115992

output:

923992
1465939
2033450
1823263
2636821
2211870
2385847
2009529
2167796
2283788


result:

ok 10 lines

Test #5:

score: 11
Accepted
time: 1ms
memory: 3604kb

input:

10
7
9
9
5
10
5
9
3
1
3

output:

7
16
25
21
31
30
39
24
25
28


result:

ok 10 lines

Test #6:

score: 11
Accepted
time: 1ms
memory: 3548kb

input:

10
541685
317557
788550
628270
601073
863693
536
94813
86706
349169

output:

541685
859242
1647792
1487512
2088585
2511485
2512021
1582325
1669031
2018200


result:

ok 10 lines

Test #7:

score: 11
Accepted
time: 0ms
memory: 3632kb

input:

10
3
5
4
1
5
4
4
2
2
4

output:

3
8
12
9
14
16
20
11
13
17


result:

ok 10 lines

Test #8:

score: 11
Accepted
time: 0ms
memory: 3628kb

input:

10
1
1
1
1
1
1
1
1
1
1

output:

1
2
3
3
4
4
5
4
4
5


result:

ok 10 lines

Test #9:

score: 11
Accepted
time: 0ms
memory: 3828kb

input:

9
1
1
1
1
1
1
1
1
1

output:

1
2
3
3
4
4
5
4
4


result:

ok 9 lines

Test #10:

score: 11
Accepted
time: 0ms
memory: 3540kb

input:

7
1
1
6
1
1
1
1

output:

1
2
8
3
4
5
6


result:

ok 7 lines

Test #11:

score: 11
Accepted
time: 0ms
memory: 3752kb

input:

3
10
42
1

output:

10
52
53


result:

ok 3 lines

Subtask #2:

score: 10
Accepted

Test #12:

score: 10
Accepted
time: 0ms
memory: 3764kb

input:

1
1

output:

1

result:

ok single line: '1'

Test #13:

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

input:

5
1
1
1
1
1

output:

1
2
3
3
4


result:

ok 5 lines

Test #14:

score: 10
Accepted
time: 1ms
memory: 3640kb

input:

300
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

1
2
3
3
4
4
5
4
4
5
6
5
6
6
6
4
5
5
6
5
6
7
8
6
5
6
5
6
7
6
7
5
6
6
7
5
6
7
7
6
7
6
7
7
7
8
9
6
6
6
7
7
8
6
7
7
7
8
9
7
8
8
7
5
6
7
8
6
7
8
9
6
7
7
7
8
9
7
8
6
5
6
7
7
7
8
8
8
9
6
7
8
8
9
9
7
8
7
7
6
7
8
9
7
7
8
9
6
7
7
7
8
9
7
8
9
8
9
9
7
7
8
9
8
6
7
8
6
7
7
8
7
8
9
8
7
8
8
9
8
9
10
9
6
7
8
7
8
9
7...

result:

ok 300 lines

Test #15:

score: 10
Accepted
time: 0ms
memory: 3540kb

input:

11
1
1
1
1
1
1
1
1
1
1
1

output:

1
2
3
3
4
4
5
4
4
5
6


result:

ok 11 lines

Test #16:

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

input:

299
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

1
2
3
3
4
4
5
4
4
5
6
5
6
6
6
4
5
5
6
5
6
7
8
6
5
6
5
6
7
6
7
5
6
6
7
5
6
7
7
6
7
6
7
7
7
8
9
6
6
6
7
7
8
6
7
7
7
8
9
7
8
8
7
5
6
7
8
6
7
8
9
6
7
7
7
8
9
7
8
6
5
6
7
7
7
8
8
8
9
6
7
8
8
9
9
7
8
7
7
6
7
8
9
7
7
8
9
6
7
7
7
8
9
7
8
9
8
9
9
7
7
8
9
8
6
7
8
6
7
7
8
7
8
9
8
7
8
8
9
8
9
10
9
6
7
8
7
8
9
7...

result:

ok 299 lines

Subtask #3:

score: 10
Accepted

Dependency #2:

100%
Accepted

Test #17:

score: 10
Accepted
time: 0ms
memory: 3828kb

input:

1
1

output:

1

result:

ok single line: '1'

Test #18:

score: 10
Accepted
time: 0ms
memory: 3564kb

input:

5
1
1
1
1
1

output:

1
2
3
3
4


result:

ok 5 lines

Test #19:

score: 10
Accepted
time: 1ms
memory: 3700kb

input:

300
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

1
2
3
3
4
4
5
4
4
5
6
5
6
6
6
4
5
5
6
5
6
7
8
6
5
6
5
6
7
6
7
5
6
6
7
5
6
7
7
6
7
6
7
7
7
8
9
6
6
6
7
7
8
6
7
7
7
8
9
7
8
8
7
5
6
7
8
6
7
8
9
6
7
7
7
8
9
7
8
6
5
6
7
7
7
8
8
8
9
6
7
8
8
9
9
7
8
7
7
6
7
8
9
7
7
8
9
6
7
7
7
8
9
7
8
9
8
9
9
7
7
8
9
8
6
7
8
6
7
7
8
7
8
9
8
7
8
8
9
8
9
10
9
6
7
8
7
8
9
7...

result:

ok 300 lines

Test #20:

score: 10
Accepted
time: 0ms
memory: 3628kb

input:

11
1
1
1
1
1
1
1
1
1
1
1

output:

1
2
3
3
4
4
5
4
4
5
6


result:

ok 11 lines

Test #21:

score: 10
Accepted
time: 0ms
memory: 3716kb

input:

299
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

1
2
3
3
4
4
5
4
4
5
6
5
6
6
6
4
5
5
6
5
6
7
8
6
5
6
5
6
7
6
7
5
6
6
7
5
6
7
7
6
7
6
7
7
7
8
9
6
6
6
7
7
8
6
7
7
7
8
9
7
8
8
7
5
6
7
8
6
7
8
9
6
7
7
7
8
9
7
8
6
5
6
7
7
7
8
8
8
9
6
7
8
8
9
9
7
8
7
7
6
7
8
9
7
7
8
9
6
7
7
7
8
9
7
8
9
8
9
9
7
7
8
9
8
6
7
8
6
7
7
8
7
8
9
8
7
8
8
9
8
9
10
9
6
7
8
7
8
9
7...

result:

ok 299 lines

Test #22:

score: 10
Accepted
time: 1ms
memory: 3636kb

input:

300
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

2
4
6
6
8
8
10
8
8
10
12
10
12
12
12
8
10
10
12
10
12
14
16
12
10
12
10
12
14
12
14
10
12
12
14
10
12
14
14
12
14
12
14
14
14
16
18
12
12
12
14
14
16
12
14
14
14
16
18
14
16
16
14
10
12
14
16
12
14
16
18
12
14
14
14
16
18
14
16
12
10
12
14
14
14
16
16
16
18
12
14
16
16
18
18
14
16
14
14
12
14
16
18
...

result:

ok 300 lines

Test #23:

score: 10
Accepted
time: 1ms
memory: 3712kb

input:

300
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
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
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

output:

3
6
9
9
12
12
15
12
12
15
18
15
18
18
18
12
15
15
18
15
18
21
24
18
15
18
15
18
21
18
21
15
18
18
21
15
18
21
21
18
21
18
21
21
21
24
27
18
18
18
21
21
24
18
21
21
21
24
27
21
24
24
21
15
18
21
24
18
21
24
27
18
21
21
21
24
27
21
24
18
15
18
21
21
21
24
24
24
27
18
21
24
24
27
27
21
24
21
21
18
21
2...

result:

ok 300 lines

Test #24:

score: 10
Accepted
time: 1ms
memory: 3712kb

input:

300
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...

output:

10
20
30
30
40
40
50
40
40
50
60
50
60
60
60
40
50
50
60
50
60
70
80
60
50
60
50
60
70
60
70
50
60
60
70
50
60
70
70
60
70
60
70
70
70
80
90
60
60
60
70
70
80
60
70
70
70
80
90
70
80
80
70
50
60
70
80
60
70
80
90
60
70
70
70
80
90
70
80
60
50
60
70
70
70
80
80
80
90
60
70
80
80
90
90
70
80
70
70
60
...

result:

ok 300 lines

Test #25:

score: 10
Accepted
time: 1ms
memory: 3864kb

input:

300
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
...

output:

100
200
300
300
400
400
500
400
400
500
600
500
600
600
600
400
500
500
600
500
600
700
800
600
500
600
500
600
700
600
700
500
600
600
700
500
600
700
700
600
700
600
700
700
700
800
900
600
600
600
700
700
800
600
700
700
700
800
900
700
800
800
700
500
600
700
800
600
700
800
900
600
700
700
700
...

result:

ok 300 lines

Test #26:

score: 10
Accepted
time: 1ms
memory: 3632kb

input:

300
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
1000000
...

output:

1000000
2000000
3000000
3000000
4000000
4000000
5000000
4000000
4000000
5000000
6000000
5000000
6000000
6000000
6000000
4000000
5000000
5000000
6000000
5000000
6000000
7000000
8000000
6000000
5000000
6000000
5000000
6000000
7000000
6000000
7000000
5000000
6000000
6000000
7000000
5000000
6000000
7000...

result:

ok 300 lines

Test #27:

score: 10
Accepted
time: 1ms
memory: 3864kb

input:

300
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
99...

output:

999999
1999998
2999997
2999997
3999996
3999996
4999995
3999996
3999996
4999995
5999994
4999995
5999994
5999994
5999994
3999996
4999995
4999995
5999994
4999995
5999994
6999993
7999992
5999994
4999995
5999994
4999995
5999994
6999993
5999994
6999993
4999995
5999994
5999994
6999993
4999995
5999994
69999...

result:

ok 300 lines

Test #28:

score: 10
Accepted
time: 1ms
memory: 3940kb

input:

300
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
123456
12...

output:

123456
246912
370368
370368
493824
493824
617280
493824
493824
617280
740736
617280
740736
740736
740736
493824
617280
617280
740736
617280
740736
864192
987648
740736
617280
740736
617280
740736
864192
740736
864192
617280
740736
740736
864192
617280
740736
864192
864192
740736
864192
740736
864192...

result:

ok 300 lines

Test #29:

score: 10
Accepted
time: 1ms
memory: 3572kb

input:

300
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
392845
39...

output:

392845
785690
1178535
1178535
1571380
1571380
1964225
1571380
1571380
1964225
2357070
1964225
2357070
2357070
2357070
1571380
1964225
1964225
2357070
1964225
2357070
2749915
3142760
2357070
1964225
2357070
1964225
2357070
2749915
2357070
2749915
1964225
2357070
2357070
2749915
1964225
2357070
274991...

result:

ok 300 lines

Subtask #4:

score: 9
Accepted

Dependency #2:

100%
Accepted

Test #30:

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

input:

1
1

output:

1

result:

ok single line: '1'

Test #31:

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

input:

5
1
1
1
1
1

output:

1
2
3
3
4


result:

ok 5 lines

Test #32:

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

input:

300
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

1
2
3
3
4
4
5
4
4
5
6
5
6
6
6
4
5
5
6
5
6
7
8
6
5
6
5
6
7
6
7
5
6
6
7
5
6
7
7
6
7
6
7
7
7
8
9
6
6
6
7
7
8
6
7
7
7
8
9
7
8
8
7
5
6
7
8
6
7
8
9
6
7
7
7
8
9
7
8
6
5
6
7
7
7
8
8
8
9
6
7
8
8
9
9
7
8
7
7
6
7
8
9
7
7
8
9
6
7
7
7
8
9
7
8
9
8
9
9
7
7
8
9
8
6
7
8
6
7
7
8
7
8
9
8
7
8
8
9
8
9
10
9
6
7
8
7
8
9
7...

result:

ok 300 lines

Test #33:

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

input:

11
1
1
1
1
1
1
1
1
1
1
1

output:

1
2
3
3
4
4
5
4
4
5
6


result:

ok 11 lines

Test #34:

score: 9
Accepted
time: 1ms
memory: 3644kb

input:

299
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

1
2
3
3
4
4
5
4
4
5
6
5
6
6
6
4
5
5
6
5
6
7
8
6
5
6
5
6
7
6
7
5
6
6
7
5
6
7
7
6
7
6
7
7
7
8
9
6
6
6
7
7
8
6
7
7
7
8
9
7
8
8
7
5
6
7
8
6
7
8
9
6
7
7
7
8
9
7
8
6
5
6
7
7
7
8
8
8
9
6
7
8
8
9
9
7
8
7
7
6
7
8
9
7
7
8
9
6
7
7
7
8
9
7
8
9
8
9
9
7
7
8
9
8
6
7
8
6
7
7
8
7
8
9
8
7
8
8
9
8
9
10
9
6
7
8
7
8
9
7...

result:

ok 1400 lines

Subtask #5:

score: 45
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #38:

score: 45
Accepted
time: 0ms
memory: 3560kb

input:

10
1
1
300
1
300
300
300
1
1
1

output:

1
2
302
3
303
602
902
4
5
6


result:

ok 10 lines

Test #39:

score: 45
Accepted
time: 0ms
memory: 3760kb

input:

5
2
3
5
8
11

output:

2
5
10
13
24


result:

ok 5 lines

Test #40:

score: 45
Accepted
time: 0ms
memory: 3548kb

input:

5
11
8
5
3
2

output:

11
19
24
22
24


result:

ok 5 lines

Test #41:

score: 45
Accepted
time: 0ms
memory: 3540kb

input:

10
923992
541947
567511
357324
813558
178420
173977
186266
158267
115992

output:

923992
1465939
2033450
1823263
2636821
2211870
2385847
2009529
2167796
2283788


result:

ok 10 lines

Test #42:

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

input:

10
7
9
9
5
10
5
9
3
1
3

output:

7
16
25
21
31
30
39
24
25
28


result:

ok 10 lines

Test #43:

score: 45
Accepted
time: 0ms
memory: 3496kb

input:

10
541685
317557
788550
628270
601073
863693
536
94813
86706
349169

output:

541685
859242
1647792
1487512
2088585
2511485
2512021
1582325
1669031
2018200


result:

ok 10 lines

Test #44:

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

input:

10
3
5
4
1
5
4
4
2
2
4

output:

3
8
12
9
14
16
20
11
13
17


result:

ok 10 lines

Test #45:

score: 45
Accepted
time: 0ms
memory: 3632kb

input:

10
1
1
1
1
1
1
1
1
1
1

output:

1
2
3
3
4
4
5
4
4
5


result:

ok 10 lines

Test #46:

score: 45
Accepted
time: 0ms
memory: 3568kb

input:

9
1
1
1
1
1
1
1
1
1

output:

1
2
3
3
4
4
5
4
4


result:

ok 9 lines

Test #47:

score: 45
Accepted
time: 0ms
memory: 3792kb

input:

7
1
1
6
1
1
1
1

output:

1
2
8
3
4
5
6


result:

ok 7 lines

Test #48:

score: 45
Accepted
time: 0ms
memory: 3536kb

input:

1
1

output:

1

result:

ok single line: '1'

Test #49:

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

input:

5
1
1
1
1
1

output:

1
2
3
3
4


result:

ok 5 lines

Test #50:

score: 45
Accepted
time: 1ms
memory: 3684kb

input:

300
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

1
2
3
3
4
4
5
4
4
5
6
5
6
6
6
4
5
5
6
5
6
7
8
6
5
6
5
6
7
6
7
5
6
6
7
5
6
7
7
6
7
6
7
7
7
8
9
6
6
6
7
7
8
6
7
7
7
8
9
7
8
8
7
5
6
7
8
6
7
8
9
6
7
7
7
8
9
7
8
6
5
6
7
7
7
8
8
8
9
6
7
8
8
9
9
7
8
7
7
6
7
8
9
7
7
8
9
6
7
7
7
8
9
7
8
9
8
9
9
7
7
8
9
8
6
7
8
6
7
7
8
7
8
9
8
7
8
8
9
8
9
10
9
6
7
8
7
8
9
7...

result:

ok 300 lines

Test #51:

score: 45
Accepted
time: 0ms
memory: 3632kb

input:

11
1
1
1
1
1
1
1
1
1
1
1

output:

1
2
3
3
4
4
5
4
4
5
6


result:

ok 11 lines

Test #52:

score: 45
Accepted
time: 1ms
memory: 3712kb

input:

299
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

1
2
3
3
4
4
5
4
4
5
6
5
6
6
6
4
5
5
6
5
6
7
8
6
5
6
5
6
7
6
7
5
6
6
7
5
6
7
7
6
7
6
7
7
7
8
9
6
6
6
7
7
8
6
7
7
7
8
9
7
8
8
7
5
6
7
8
6
7
8
9
6
7
7
7
8
9
7
8
6
5
6
7
7
7
8
8
8
9
6
7
8
8
9
9
7
8
7
7
6
7
8
9
7
7
8
9
6
7
7
7
8
9
7
8
9
8
9
9
7
7
8
9
8
6
7
8
6
7
7
8
7
8
9
8
7
8
8
9
8
9
10
9
6
7
8
7
8
9
7...

result:

ok 299 lines

Test #53:

score: 45
Accepted
time: 1ms
memory: 3904kb

input:

301
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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
7
7
8
9
6
7
7
7
8
9
7
8
9
8
9
9
7
7
8
9
8
6
7
8
6
7
7
8
7
8
9
8
7
8
8
9
8
9
10
9
6
7
8
7
8
9
7...

result:

ok 1399 lines

Test #55:

score: 45
Accepted
time: 5ms
memory: 4356kb

input:

1400
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

1
2
3
3
4
4
5
4
4
5
6
5
6
6
6
4
5
5
6
5
6
7
8
6
5
6
5
6
7
6
7
5
6
6
7
5
6
7
7
6
7
6
7
7
7
8
9
6
6
6
7
7
8
6
7
7
7
8
9
7
8
8
7
5
6
7
8
6
7
8
9
6
7
7
7
8
9
7
8
6
5
6
7
7
7
8
8
8
9
6
7
8
8
9
9
7
8
7
7
6
7
8
9
7
7
8
9
6
7
7
7
8
9
7
8
9
8
9
9
7
7
8
9
8
6
7
8
6
7
7
8
7
8
9
8
7
8
8
9
8
9
10
9
6
7
8
7
8
9
7...

result:

ok 1400 lines

Test #56:

score: 45
Accepted
time: 32ms
memory: 7276kb

input:

5000
70129
975035
45848
254946
861628
479219
357218
333562
905079
383680
536492
802874
450147
593434
408478
355022
848295
667869
37556
300142
628924
261168
729809
671097
250984
243132
598554
998041
417632
935409
451275
58472
291473
480225
742410
958982
680047
78640
400800
292834
818162
378438
607972...

output:

70129
1045164
1091012
1300110
2161738
1570231
1927449
1633672
1996091
2379771
2916263
2148832
2598979
2520883
2616064
1655132
2503427
2238100
2275656
2461880
2556373
2817541
3547350
2350617
2412722
2655854
2594645
3180436
3598068
3315180
3766455
1692144
1983617
2463842
3206252
2529213
3209260
235429...

result:

ok 5000 lines

Test #57:

score: 45
Accepted
time: 8ms
memory: 4760kb

input:

2047
1
1
1030
1
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
10...

output:

1
2
1032
3
1033
2062
3092
1033
2062
2063
3093
2063
3093
4122
3093
4
1034
2064
3094
2063
3093
4123
5153
3093
2063
3093
3092
4122
5152
3093
4123
1034
2064
2064
3094
3092
4122
4124
4123
3093
4123
4122
5152
4123
4123
5153
6183
2064
3094
3093
3094
4123
5153
4122
4123
5152
5152
6182
7212
4123
5153
5153
51...

result:

ok 2047 lines

Test #58:

score: 45
Accepted
time: 25ms
memory: 7260kb

input:

5000
960974
990745
961879
998618
944566
995811
990546
990635
960711
947236
900025
931426
954054
910921
989346
956651
951708
929159
946500
992198
944279
991362
915819
984415
950930
992891
909100
908013
951488
915107
952374
998687
992899
936928
928383
971113
983389
908442
935462
996988
926260
964195
9...

output:

960974
1951719
2913598
2950337
3894903
3909409
4899955
3940972
3874309
4821545
5721570
4840835
5794889
5810876
5846128
3906988
4858696
4803468
5749968
4887101
5831380
6712932
7628751
5825250
4845833
5838724
4783409
5691422
6642910
5736652
6689026
4905675
5898574
5795624
6724007
4880522
5863911
66584...

result:

ok 5000 lines

Test #59:

score: 45
Accepted
time: 28ms
memory: 7256kb

input:

5000
218
50
928
278
191
514
729
642
735
466
669
557
845
401
710
622
747
468
954
725
537
926
591
613
861
801
808
747
671
150
793
837
30
141
819
647
653
449
824
66
902
944
432
454
352
359
920
801
912
869
472
475
914
133
681
443
771
963
108
779
445
144
586
61
5
372
345
973
514
731
453
814
477
801
43
54...

output:

218
268
1196
546
737
1251
1980
1188
1923
1203
1872
1808
2653
2381
2375
1168
1915
2178
3132
1462
1999
2798
3389
1864
1598
2399
2739
2727
3398
1401
2194
2005
2035
2056
2799
1898
2551
3000
3700
1269
2171
2924
3356
2326
2466
2825
3745
2609
2892
2072
2544
2874
3788
2311
2553
2824
3595
4361
4469
2180
2625...

result:

ok 5000 lines

Test #60:

score: 45
Accepted
time: 25ms
memory: 7264kb

input:

5000
8
6
1
6
3
3
9
10
3
4
9
3
2
9
1
4
7
4
7
1
4
5
9
5
2
9
1
7
6
9
8
3
10
6
6
4
10
3
3
5
5
10
4
7
3
2
6
6
10
9
2
4
2
2
9
5
4
2
1
6
7
6
8
1
10
1
1
7
1
9
3
3
9
8
2
9
4
2
5
9
4
3
7
10
9
5
9
7
5
7
4
1
7
5
2
5
2
8
4
10
6
10
6
5
8
10
7
4
6
8
9
4
9
6
5
10
6
2
7
10
3
4
3
7
6
8
7
8
2
9
2
10
8
8
1
6
9
3
4
5
4
...

output:

8
14
15
20
23
18
27
30
18
22
31
21
23
32
25
24
31
22
29
23
27
32
41
26
25
32
19
26
32
31
39
27
37
37
41
22
32
32
26
28
33
37
41
39
28
30
36
30
37
34
34
30
32
21
30
31
33
34
35
29
36
42
35
25
35
33
34
38
39
43
46
24
33
40
27
36
40
25
30
33
22
25
32
36
43
46
41
40
45
29
33
31
38
41
40
33
35
43
35
32
3...

result:

ok 5000 lines

Test #61:

score: 45
Accepted
time: 24ms
memory: 7140kb

input:

5000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

1
2
3
3
4
4
5
4
4
5
6
5
6
6
6
4
5
5
6
5
6
7
8
6
5
6
5
6
7
6
7
5
6
6
7
5
6
7
7
6
7
6
7
7
7
8
9
6
6
6
7
7
8
6
7
7
7
8
9
7
8
8
7
5
6
7
8
6
7
8
9
6
7
7
7
8
9
7
8
6
5
6
7
7
7
8
8
8
9
6
7
8
8
9
9
7
8
7
7
6
7
8
9
7
7
8
9
6
7
7
7
8
9
7
8
9
8
9
9
7
7
8
9
8
6
7
8
6
7
7
8
7
8
9
8
7
8
8
9
8
9
10
9
6
7
8
7
8
9
7...

result:

ok 5000 lines

Test #62:

score: 45
Accepted
time: 28ms
memory: 7176kb

input:

5000
104
102
103
103
104
105
101
105
104
104
102
105
101
101
103
100
105
102
101
101
102
100
100
104
101
103
102
102
102
104
102
103
102
100
102
103
104
100
105
102
100
102
103
101
105
100
103
105
103
100
103
105
103
100
104
104
105
103
101
100
103
102
104
100
105
102
103
105
102
104
104
101
104
103...

output:

104
206
309
309
413
414
515
414
413
517
619
517
618
616
619
409
514
515
616
514
616
716
816
621
514
617
515
617
719
621
723
512
614
614
716
517
621
716
723
616
716
617
720
720
724
824
927
617
618
614
717
722
825
615
719
721
721
822
923
717
820
825
721
509
614
716
819
619
721
820
924
618
722
724
721
...

result:

ok 5000 lines

Test #63:

score: 45
Accepted
time: 28ms
memory: 7492kb

input:

5000
1045
1026
1005
1031
1031
1039
1019
1027
1014
1015
1003
1049
1004
1003
1038
1002
1016
1038
1013
1026
1034
1011
1018
1017
1039
1020
1001
1021
1031
1003
1020
1036
1002
1009
1002
1035
1029
1020
1005
1009
1002
1014
1003
1045
1048
1037
1030
1015
1016
1038
1050
1041
1039
1038
1039
1044
1004
1045
1047
...

output:

1045
2071
3076
3102
4133
4115
5134
4129
4090
5105
6108
5156
6160
6137
6176
4104
5120
5128
6141
5159
6168
7119
8137
6151
5172
6192
5091
6112
7143
6108
7128
5140
6142
6129
7131
5150
6179
7161
7165
6157
7159
6148
7151
7196
7200
8237
9267
6124
6150
6186
7175
7201
8240
6129
7168
7156
7145
8188
9235
7118
...

result:

ok 5000 lines

Test #64:

score: 45
Accepted
time: 25ms
memory: 7272kb

input:

4999
1031
1048
1025
1029
1030
1047
1010
1006
1042
1020
1005
1026
1023
1011
1007
1011
1043
1004
1043
1002
1027
1025
1040
1042
1023
1044
1027
1008
1036
1029
1020
1005
1045
1043
1003
1047
1035
1026
1019
1004
1048
1019
1022
1020
1003
1032
1041
1021
1037
1030
1025
1032
1030
1029
1020
1041
1015
1005
1039
...

output:

1031
2079
3104
3108
4138
4151
5161
4114
4146
5158
6163
5159
6182
6172
6170
4119
5162
5150
6193
5140
6167
7188
8228
6181
5161
6205
5173
6181
7217
6195
7215
5119
6164
6205
7198
5198
6233
7219
7201
6144
7192
6180
7202
7183
7173
8205
9246
6165
6198
6188
7212
7214
8244
6179
7183
7208
7208
8213
9252
7196
...

result:

ok 4999 lines

Test #65:

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

input:

3
10
42
1

output:

10
52
53


result:

ok 3 lines

Subtask #6:

score: 15
Accepted

Dependency #5:

100%
Accepted

Test #66:

score: 15
Accepted
time: 1ms
memory: 3612kb

input:

10
1
1
300
1
300
300
300
1
1
1

output:

1
2
302
3
303
602
902
4
5
6


result:

ok 10 lines

Test #67:

score: 15
Accepted
time: 0ms
memory: 3756kb

input:

5
2
3
5
8
11

output:

2
5
10
13
24


result:

ok 5 lines

Test #68:

score: 15
Accepted
time: 0ms
memory: 3620kb

input:

5
11
8
5
3
2

output:

11
19
24
22
24


result:

ok 5 lines

Test #69:

score: 15
Accepted
time: 0ms
memory: 3548kb

input:

10
923992
541947
567511
357324
813558
178420
173977
186266
158267
115992

output:

923992
1465939
2033450
1823263
2636821
2211870
2385847
2009529
2167796
2283788


result:

ok 10 lines

Test #70:

score: 15
Accepted
time: 0ms
memory: 3528kb

input:

10
7
9
9
5
10
5
9
3
1
3

output:

7
16
25
21
31
30
39
24
25
28


result:

ok 10 lines

Test #71:

score: 15
Accepted
time: 0ms
memory: 3832kb

input:

10
541685
317557
788550
628270
601073
863693
536
94813
86706
349169

output:

541685
859242
1647792
1487512
2088585
2511485
2512021
1582325
1669031
2018200


result:

ok 10 lines

Test #72:

score: 15
Accepted
time: 0ms
memory: 3796kb

input:

10
3
5
4
1
5
4
4
2
2
4

output:

3
8
12
9
14
16
20
11
13
17


result:

ok 10 lines

Test #73:

score: 15
Accepted
time: 0ms
memory: 3624kb

input:

10
1
1
1
1
1
1
1
1
1
1

output:

1
2
3
3
4
4
5
4
4
5


result:

ok 10 lines

Test #74:

score: 15
Accepted
time: 0ms
memory: 3552kb

input:

9
1
1
1
1
1
1
1
1
1

output:

1
2
3
3
4
4
5
4
4


result:

ok 9 lines

Test #75:

score: 15
Accepted
time: 0ms
memory: 3492kb

input:

7
1
1
6
1
1
1
1

output:

1
2
8
3
4
5
6


result:

ok 7 lines

Test #76:

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

input:

1
1

output:

1

result:

ok single line: '1'

Test #77:

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

input:

5
1
1
1
1
1

output:

1
2
3
3
4


result:

ok 5 lines

Test #78:

score: 15
Accepted
time: 1ms
memory: 3936kb

input:

300
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

1
2
3
3
4
4
5
4
4
5
6
5
6
6
6
4
5
5
6
5
6
7
8
6
5
6
5
6
7
6
7
5
6
6
7
5
6
7
7
6
7
6
7
7
7
8
9
6
6
6
7
7
8
6
7
7
7
8
9
7
8
8
7
5
6
7
8
6
7
8
9
6
7
7
7
8
9
7
8
6
5
6
7
7
7
8
8
8
9
6
7
8
8
9
9
7
8
7
7
6
7
8
9
7
7
8
9
6
7
7
7
8
9
7
8
9
8
9
9
7
7
8
9
8
6
7
8
6
7
7
8
7
8
9
8
7
8
8
9
8
9
10
9
6
7
8
7
8
9
7...

result:

ok 300 lines

Test #79:

score: 15
Accepted
time: 0ms
memory: 3632kb

input:

11
1
1
1
1
1
1
1
1
1
1
1

output:

1
2
3
3
4
4
5
4
4
5
6


result:

ok 11 lines

Test #80:

score: 15
Accepted
time: 1ms
memory: 3724kb

input:

299
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

1
2
3
3
4
4
5
4
4
5
6
5
6
6
6
4
5
5
6
5
6
7
8
6
5
6
5
6
7
6
7
5
6
6
7
5
6
7
7
6
7
6
7
7
7
8
9
6
6
6
7
7
8
6
7
7
7
8
9
7
8
8
7
5
6
7
8
6
7
8
9
6
7
7
7
8
9
7
8
6
5
6
7
7
7
8
8
8
9
6
7
8
8
9
9
7
8
7
7
6
7
8
9
7
7
8
9
6
7
7
7
8
9
7
8
9
8
9
9
7
7
8
9
8
6
7
8
6
7
7
8
7
8
9
8
7
8
8
9
8
9
10
9
6
7
8
7
8
9
7...

result:

ok 299 lines

Test #81:

score: 15
Accepted
time: 1ms
memory: 3708kb

input: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5
6
7
7
6
7
6
7
7
7
8
9
6
6
6
7
7
8
6
7
7
7
8
9
7
8
8
7
5
6
7
8
6
7
8
9
6
7
7
7
8
9
7
8
6
5
6
7
7
7
8
8
8
9
6
7
8
8
9
9
7
8
7
7
6
7
8
9
7
7
8
9
6
7
7
7
8
9
7
8
9
8
9
9
7
7
8
9
8
6
7
8
6
7
7
8
7
8
9
8
7
8
8
9
8
9
10
9
6
7
8
7
8
9
7...

result:

ok 1399 lines

Test #83:

score: 15
Accepted
time: 5ms
memory: 4284kb

input:

1400
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

1
2
3
3
4
4
5
4
4
5
6
5
6
6
6
4
5
5
6
5
6
7
8
6
5
6
5
6
7
6
7
5
6
6
7
5
6
7
7
6
7
6
7
7
7
8
9
6
6
6
7
7
8
6
7
7
7
8
9
7
8
8
7
5
6
7
8
6
7
8
9
6
7
7
7
8
9
7
8
6
5
6
7
7
7
8
8
8
9
6
7
8
8
9
9
7
8
7
7
6
7
8
9
7
7
8
9
6
7
7
7
8
9
7
8
9
8
9
9
7
7
8
9
8
6
7
8
6
7
7
8
7
8
9
8
7
8
8
9
8
9
10
9
6
7
8
7
8
9
7...

result:

ok 1400 lines

Test #84:

score: 15
Accepted
time: 29ms
memory: 7216kb

input:

5000
70129
975035
45848
254946
861628
479219
357218
333562
905079
383680
536492
802874
450147
593434
408478
355022
848295
667869
37556
300142
628924
261168
729809
671097
250984
243132
598554
998041
417632
935409
451275
58472
291473
480225
742410
958982
680047
78640
400800
292834
818162
378438
607972...

output:

70129
1045164
1091012
1300110
2161738
1570231
1927449
1633672
1996091
2379771
2916263
2148832
2598979
2520883
2616064
1655132
2503427
2238100
2275656
2461880
2556373
2817541
3547350
2350617
2412722
2655854
2594645
3180436
3598068
3315180
3766455
1692144
1983617
2463842
3206252
2529213
3209260
235429...

result:

ok 5000 lines

Test #85:

score: 15
Accepted
time: 8ms
memory: 4828kb

input:

2047
1
1
1030
1
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
1030
10...

output:

1
2
1032
3
1033
2062
3092
1033
2062
2063
3093
2063
3093
4122
3093
4
1034
2064
3094
2063
3093
4123
5153
3093
2063
3093
3092
4122
5152
3093
4123
1034
2064
2064
3094
3092
4122
4124
4123
3093
4123
4122
5152
4123
4123
5153
6183
2064
3094
3093
3094
4123
5153
4122
4123
5152
5152
6182
7212
4123
5153
5153
51...

result:

ok 2047 lines

Test #86:

score: 15
Accepted
time: 28ms
memory: 7268kb

input:

5000
960974
990745
961879
998618
944566
995811
990546
990635
960711
947236
900025
931426
954054
910921
989346
956651
951708
929159
946500
992198
944279
991362
915819
984415
950930
992891
909100
908013
951488
915107
952374
998687
992899
936928
928383
971113
983389
908442
935462
996988
926260
964195
9...

output:

960974
1951719
2913598
2950337
3894903
3909409
4899955
3940972
3874309
4821545
5721570
4840835
5794889
5810876
5846128
3906988
4858696
4803468
5749968
4887101
5831380
6712932
7628751
5825250
4845833
5838724
4783409
5691422
6642910
5736652
6689026
4905675
5898574
5795624
6724007
4880522
5863911
66584...

result:

ok 5000 lines

Test #87:

score: 15
Accepted
time: 25ms
memory: 7148kb

input:

5000
218
50
928
278
191
514
729
642
735
466
669
557
845
401
710
622
747
468
954
725
537
926
591
613
861
801
808
747
671
150
793
837
30
141
819
647
653
449
824
66
902
944
432
454
352
359
920
801
912
869
472
475
914
133
681
443
771
963
108
779
445
144
586
61
5
372
345
973
514
731
453
814
477
801
43
54...

output:

218
268
1196
546
737
1251
1980
1188
1923
1203
1872
1808
2653
2381
2375
1168
1915
2178
3132
1462
1999
2798
3389
1864
1598
2399
2739
2727
3398
1401
2194
2005
2035
2056
2799
1898
2551
3000
3700
1269
2171
2924
3356
2326
2466
2825
3745
2609
2892
2072
2544
2874
3788
2311
2553
2824
3595
4361
4469
2180
2625...

result:

ok 5000 lines

Test #88:

score: 15
Accepted
time: 28ms
memory: 7144kb

input:

5000
8
6
1
6
3
3
9
10
3
4
9
3
2
9
1
4
7
4
7
1
4
5
9
5
2
9
1
7
6
9
8
3
10
6
6
4
10
3
3
5
5
10
4
7
3
2
6
6
10
9
2
4
2
2
9
5
4
2
1
6
7
6
8
1
10
1
1
7
1
9
3
3
9
8
2
9
4
2
5
9
4
3
7
10
9
5
9
7
5
7
4
1
7
5
2
5
2
8
4
10
6
10
6
5
8
10
7
4
6
8
9
4
9
6
5
10
6
2
7
10
3
4
3
7
6
8
7
8
2
9
2
10
8
8
1
6
9
3
4
5
4
...

output:

8
14
15
20
23
18
27
30
18
22
31
21
23
32
25
24
31
22
29
23
27
32
41
26
25
32
19
26
32
31
39
27
37
37
41
22
32
32
26
28
33
37
41
39
28
30
36
30
37
34
34
30
32
21
30
31
33
34
35
29
36
42
35
25
35
33
34
38
39
43
46
24
33
40
27
36
40
25
30
33
22
25
32
36
43
46
41
40
45
29
33
31
38
41
40
33
35
43
35
32
3...

result:

ok 5000 lines

Test #89:

score: 15
Accepted
time: 25ms
memory: 7180kb

input:

5000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

1
2
3
3
4
4
5
4
4
5
6
5
6
6
6
4
5
5
6
5
6
7
8
6
5
6
5
6
7
6
7
5
6
6
7
5
6
7
7
6
7
6
7
7
7
8
9
6
6
6
7
7
8
6
7
7
7
8
9
7
8
8
7
5
6
7
8
6
7
8
9
6
7
7
7
8
9
7
8
6
5
6
7
7
7
8
8
8
9
6
7
8
8
9
9
7
8
7
7
6
7
8
9
7
7
8
9
6
7
7
7
8
9
7
8
9
8
9
9
7
7
8
9
8
6
7
8
6
7
7
8
7
8
9
8
7
8
8
9
8
9
10
9
6
7
8
7
8
9
7...

result:

ok 5000 lines

Test #90:

score: 15
Accepted
time: 29ms
memory: 7280kb

input:

5000
104
102
103
103
104
105
101
105
104
104
102
105
101
101
103
100
105
102
101
101
102
100
100
104
101
103
102
102
102
104
102
103
102
100
102
103
104
100
105
102
100
102
103
101
105
100
103
105
103
100
103
105
103
100
104
104
105
103
101
100
103
102
104
100
105
102
103
105
102
104
104
101
104
103...

output:

104
206
309
309
413
414
515
414
413
517
619
517
618
616
619
409
514
515
616
514
616
716
816
621
514
617
515
617
719
621
723
512
614
614
716
517
621
716
723
616
716
617
720
720
724
824
927
617
618
614
717
722
825
615
719
721
721
822
923
717
820
825
721
509
614
716
819
619
721
820
924
618
722
724
721
...

result:

ok 5000 lines

Test #91:

score: 15
Accepted
time: 24ms
memory: 7284kb

input:

5000
1045
1026
1005
1031
1031
1039
1019
1027
1014
1015
1003
1049
1004
1003
1038
1002
1016
1038
1013
1026
1034
1011
1018
1017
1039
1020
1001
1021
1031
1003
1020
1036
1002
1009
1002
1035
1029
1020
1005
1009
1002
1014
1003
1045
1048
1037
1030
1015
1016
1038
1050
1041
1039
1038
1039
1044
1004
1045
1047
...

output:

1045
2071
3076
3102
4133
4115
5134
4129
4090
5105
6108
5156
6160
6137
6176
4104
5120
5128
6141
5159
6168
7119
8137
6151
5172
6192
5091
6112
7143
6108
7128
5140
6142
6129
7131
5150
6179
7161
7165
6157
7159
6148
7151
7196
7200
8237
9267
6124
6150
6186
7175
7201
8240
6129
7168
7156
7145
8188
9235
7118
...

result:

ok 5000 lines

Test #92:

score: 15
Accepted
time: 25ms
memory: 7124kb

input:

4999
1031
1048
1025
1029
1030
1047
1010
1006
1042
1020
1005
1026
1023
1011
1007
1011
1043
1004
1043
1002
1027
1025
1040
1042
1023
1044
1027
1008
1036
1029
1020
1005
1045
1043
1003
1047
1035
1026
1019
1004
1048
1019
1022
1020
1003
1032
1041
1021
1037
1030
1025
1032
1030
1029
1020
1041
1015
1005
1039
...

output:

1031
2079
3104
3108
4138
4151
5161
4114
4146
5158
6163
5159
6182
6172
6170
4119
5162
5150
6193
5140
6167
7188
8228
6181
5161
6205
5173
6181
7217
6195
7215
5119
6164
6205
7198
5198
6233
7219
7201
6144
7192
6180
7202
7183
7173
8205
9246
6165
6198
6188
7212
7214
8244
6179
7183
7208
7208
8213
9252
7196
...

result:

ok 4999 lines

Test #93:

score: 15
Accepted
time: 165ms
memory: 19464kb

input:

16383
1
1
8201
1
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
1
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8201
8...

output:

1
2
8203
3
8204
16404
24605
8204
16404
16405
24606
16405
24606
32806
24606
4
8205
16406
24607
16405
24606
32807
41008
24606
16405
24606
24605
32806
41007
24606
32807
8205
16406
16406
24607
24605
32806
32808
32807
24606
32807
32806
41007
32807
32807
41008
49209
16406
24607
24606
24607
32807
41008
328...

result:

ok 16383 lines

Test #94:

score: 15
Accepted
time: 417ms
memory: 37072kb

input:

30000
187006
314576
527730
637984
10483
137850
480480
235406
715286
128843
999753
385558
948277
4515
740257
57606
403636
540835
181951
539529
363264
199237
231710
896526
752892
819961
531985
352361
870144
186114
630210
390850
595996
858520
283710
760642
23270
343293
699665
199092
408201
385415
37031...

output:

187006
501582
1029312
1139566
1150049
1167162
1647642
1374972
1744598
1278892
2278645
1552720
2500997
1652157
2392414
1197172
1600808
1707997
1889948
1689578
2010906
2210143
2441853
2184425
1902941
2722902
2276583
2004518
2874662
1474013
2104223
1588022
2184018
2459328
2052089
1927804
1951074
223324...

result:

ok 30000 lines

Test #95:

score: 15
Accepted
time: 420ms
memory: 37196kb

input:

30000
938665
996758
973748
903210
974280
904407
967287
971627
942208
964143
959509
999357
905338
903089
934617
943960
903214
915960
931768
951707
965606
937094
949202
974768
990222
917346
951935
975847
994642
931580
910268
978043
945814
916765
936680
981943
935040
999248
931793
902347
912320
908467
...

output:

938665
1935423
2909171
2838633
3812913
3813578
4780865
3810260
3851379
4777056
5736565
4811738
5717076
5683954
5721278
3782593
4685807
4729538
5661306
4764620
5730226
6667320
7616522
5691556
4803135
5720481
4803314
5779161
6773803
5648900
6559168
4760636
5706450
5602572
6539252
4795521
5730561
66605...

result:

ok 30000 lines

Test #96:

score: 15
Accepted
time: 440ms
memory: 37192kb

input:

30000
736
388
98
681
17
852
512
450
507
23
917
36
601
952
563
335
485
737
673
401
490
861
705
89
204
645
211
619
999
860
433
232
95
6
362
462
709
442
663
430
266
19
761
880
427
502
552
204
274
680
72
977
975
642
750
206
130
11
504
914
491
307
727
876
362
403
746
758
414
264
672
422
793
717
839
670
9...

output:

736
1124
1222
1805
1822
2074
2586
2255
1729
1752
2669
1939
2540
3492
2483
2140
2625
2466
3139
2153
2643
3504
4209
2028
2026
2671
1940
2559
3558
2612
3045
2372
2467
2473
2835
2401
3110
3552
3203
2275
2541
2560
3321
3642
2854
3356
3908
2143
2417
2525
2597
3517
4492
2582
3332
2765
2895
2906
3410
2870
3...

result:

ok 30000 lines

Test #97:

score: 15
Accepted
time: 434ms
memory: 37176kb

input:

30000
9
99
11
52
87
36
35
91
31
60
54
72
67
18
24
63
12
50
9
51
7
88
78
35
21
25
8
28
70
95
15
14
35
71
27
5
64
66
100
65
6
99
10
85
97
97
77
94
45
51
59
50
99
97
28
15
30
99
73
79
93
55
83
63
84
48
42
87
57
19
62
21
48
46
86
66
62
53
72
42
14
94
11
19
55
73
17
7
57
42
71
8
78
42
97
85
76
44
14
70
1...

output:

9
108
119
160
247
155
190
251
150
210
264
227
294
208
232
223
235
200
209
260
197
285
363
242
263
288
158
186
256
305
320
237
272
306
333
160
224
275
375
325
331
289
299
370
329
426
503
328
235
286
305
338
437
255
283
201
231
330
403
325
418
375
280
286
370
320
362
322
379
300
362
181
229
270
349
32...

result:

ok 30000 lines

Test #98:

score: 15
Accepted
time: 431ms
memory: 37180kb

input:

30000
102
101
100
100
103
104
103
105
104
105
101
101
103
103
104
105
104
101
102
101
100
102
100
101
101
105
102
104
105
104
104
105
102
102
102
100
100
104
105
100
102
105
103
101
101
100
101
100
105
105
102
102
103
103
103
105
100
105
101
104
105
103
101
101
100
101
102
104
100
103
100
102
102
10...

output:

102
203
303
303
406
407
510
408
407
511
612
504
607
613
610
408
512
508
610
507
607
709
809
605
507
612
509
613
718
614
718
513
615
614
715
507
607
711
712
607
709
615
718
713
711
811
912
604
615
612
714
709
812
611
714
718
710
815
916
711
816
821
711
509
609
710
812
616
716
818
918
609
711
709
710
...

result:

ok 30000 lines

Test #99:

score: 15
Accepted
time: 439ms
memory: 37180kb

input:

30000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

1
2
3
3
4
4
5
4
4
5
6
5
6
6
6
4
5
5
6
5
6
7
8
6
5
6
5
6
7
6
7
5
6
6
7
5
6
7
7
6
7
6
7
7
7
8
9
6
6
6
7
7
8
6
7
7
7
8
9
7
8
8
7
5
6
7
8
6
7
8
9
6
7
7
7
8
9
7
8
6
5
6
7
7
7
8
8
8
9
6
7
8
8
9
9
7
8
7
7
6
7
8
9
7
7
8
9
6
7
7
7
8
9
7
8
9
8
9
9
7
7
8
9
8
6
7
8
6
7
7
8
7
8
9
8
7
8
8
9
8
9
10
9
6
7
8
7
8
9
7...

result:

ok 30000 lines

Test #100:

score: 15
Accepted
time: 433ms
memory: 37184kb

input:

30000
4
2
4
3
6
8
2
3
10
10
10
4
4
10
2
4
2
8
10
8
7
8
1
1
6
4
7
10
6
7
9
9
5
10
3
2
9
7
4
2
3
4
8
10
10
5
10
1
3
1
6
1
5
9
10
9
6
6
9
5
1
1
7
7
7
7
2
10
1
2
4
2
5
5
3
7
9
1
4
7
6
5
1
9
1
2
1
4
10
10
4
5
9
7
5
6
9
6
3
7
3
5
3
7
3
9
9
9
7
5
2
1
1
3
8
3
1
7
9
7
7
5
6
9
1
3
7
2
5
1
3
7
10
5
8
9
8
9
10
...

output:

4
6
10
9
15
18
20
12
20
25
35
17
21
30
21
13
15
23
33
23
27
35
36
17
21
25
27
33
39
28
37
21
26
25
28
19
28
35
25
20
23
24
32
42
31
36
46
18
21
22
25
22
27
35
45
32
38
44
53
26
27
28
34
19
26
33
35
25
26
28
32
19
24
29
24
31
40
26
30
26
26
28
29
33
22
24
25
29
39
38
32
37
46
53
44
23
32
27
30
28
31
...

result:

ok 30000 lines

Test #101:

score: 15
Accepted
time: 0ms
memory: 3596kb

input:

3
10
42
1

output:

10
52
53


result:

ok 3 lines