QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#87724#4929. Longest Unfriendly Subsequencesnpmrnhlol54 177ms21288kbC++144.2kb2023-03-14 05:38:252023-03-14 05:38:26

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-14 05:38:26]
  • 评测
  • 测评结果:54
  • 用时:177ms
  • 内存:21288kb
  • [2023-03-14 05:38:25]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int v[200000];
int pre[200000][6];
map <int,int> f;
pair <int,int> dp[200001][2];
///first - chosen bitch, second - maxxxxxx
void solve(){
    f.clear();
    int n,i,j,l,cnt = 1,ans = 0;
    cin>>n;
    for(i = 0;i < n;i++){
        cin>>v[i];
        f[v[i]] = 1;
        for(j = 0;j < 6;j++)pre[i][j] = -1;
        dp[i][0] = dp[i][1] = {0,-1};
    }
    dp[n][0] = dp[n][1] = {0,-1};
    for(auto &i:f){
        i.second = cnt++;
    }
    for(i = 0;i < n;i++){
        v[i] = f[v[i]];
        bool ok = 0;
        if(i)for(j = 0;j < 6;j++){
            if(pre[i - 1][j] == v[i]){
                ///same
                for(l = j + 1;l < 6;l++)pre[i][l] = pre[i - 1][l];
                for(l = j;l > 0;l--){
                    pre[i][l] = pre[i - 1][l - 1];
                }
                pre[i][0] = v[i];
                ok = 1;
            }
        }
        if(!ok){
            if(i)for(j = 6;j > 0;j--){
                pre[i][j] = pre[i - 1][j - 1];
            }
            pre[i][0] = v[i];
        }
    }
    for(i = 0;i < n;i++){
        int cur = 0,cand = -1,cur2 = 0,cand2 = -1;
        if(i)for(j = 0;j < 6;j++){
            if(pre[i - 1][j] == -1 || pre[i - 1][j] == v[i])continue;
            //if(v[i] == 2)cout<<pre[i - 1][j]<<' '<<dp[pre[i - 1][j]][0].first<<' '<<dp[pre[i - 1][j]][0].second<<' '<<dp[pre[i - 1][j]][1].first<<' '<<dp[pre[i - 1][j]][1].second<<'\n';
            //if(pre[i - 1][j] == 3)cout<<pre[i - 1][j]<<' '<<dp[pre[i - 1][j]][0].first<<' '<<dp[pre[i - 1][j]][0].second<<' '<<dp[pre[i - 1][j]][1].first<<' '<<dp[pre[i - 1][j]][1].second<<'\n';
            if(dp[pre[i - 1][j]][0].first != v[i] && dp[pre[i - 1][j]][0].second >= cur){
                cur = dp[pre[i - 1][j]][0].second;
                cand = pre[i - 1][j];
            }
            if(dp[pre[i - 1][j]][1].first != v[i] && dp[pre[i - 1][j]][1].second >= cur){
                cur = dp[pre[i - 1][j]][1].second;
                cand = pre[i - 1][j];
            }
        }
        if(i)for(j = 0;j < 6;j++){
            if(pre[i - 1][j] == -1 || pre[i - 1][j] == v[i] || pre[i - 1][j] == cand)continue;
            //cout<<pre[i - 1][j]<<' ';
            if(dp[pre[i - 1][j]][0].first != v[i] && dp[pre[i - 1][j]][0].second >= cur2){
                cur2 = dp[pre[i - 1][j]][0].second;
                cand2 = pre[i - 1][j];
            }
            if(dp[pre[i - 1][j]][1].first != v[i] && dp[pre[i - 1][j]][1].second >= cur2){
                cur2 = dp[pre[i - 1][j]][1].second;
                cand2 = pre[i - 1][j];
            }
        }
        cur2++;
        cur++;
        ans = max(ans,cur);
        ans = max(ans,cur2);
        //cout<<v[i]<<' ';
        //cout<<cur<<' '<<cand<<' '<<cur2<<' '<<cand2<<'\n';
        ///propagation
        if(dp[v[i]][0].first == cand){
            if(dp[v[i]][0].second <= cur){
                dp[v[i]][0].second = cur;
            }
        }else if(dp[v[i]][1].first == cand){
            if(dp[v[i]][1].second <= cur){
                dp[v[i]][1].second = cur;
                if(dp[v[i]][1].second >= dp[v[i]][0].second)swap(dp[v[i]][1],dp[v[i]][0]);
            }
        }else if(dp[v[i]][0].second <= cur){
            dp[v[i]][1] = dp[v[i]][0];
            dp[v[i]][0] = {cand,cur};
        }else if(dp[v[i]][1].second <= cur){
            dp[v[i]][1] = {cand,cur};
        }
        if(dp[v[i]][0].first == cand2){
            if(dp[v[i]][0].second <= cur2){
                dp[v[i]][0].second = cur2;
            }
        }else if(dp[v[i]][1].first == cand2){
            if(dp[v[i]][1].second <= cur2){
                dp[v[i]][1].second = cur2;
                if(dp[v[i]][1].second >= dp[v[i]][0].second)swap(dp[v[i]][1],dp[v[i]][0]);
            }
        }else if(dp[v[i]][0].second <= cur2){
            dp[v[i]][1] = dp[v[i]][0];
            dp[v[i]][0] = {cand2,cur2};
        }else if(dp[v[i]][1].second <= cur2){
            dp[v[i]][1] = {cand2,cur2};
        }
        //cout<<v[i]<<' '<<dp[v[i]][0].first<<' '<<dp[v[i]][0].second<<' '<<dp[v[i]][1].first<<' '<<dp[v[i]][1].second<<'\n';
    }
    cout<<ans<<'\n';
}
int main(){
    int t;
    cin>>t;
    while(t--)solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 3
Accepted
time: 65ms
memory: 11964kb

input:

1
200000
259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 2...

output:

1

result:

ok single line: '1'

Test #2:

score: -3
Wrong Answer
time: 121ms
memory: 21288kb

input:

1
200000
1521 1638 11981 18811 20091 22081 30494 31501 42139 42282 48197 55520 57632 69584 81745 85026 90303 91482 92176 98507 108061 108743 111257 121226 127217 127449 137116 163474 169192 175764 181243 185402 191244 198775 202845 212156 217723 220058 223478 224205 227614 228398 230425 232567 24480...

output:

198857

result:

wrong answer 1st lines differ - expected: '198858', found: '198857'

Subtask #2:

score: 6
Accepted

Test #15:

score: 6
Accepted
time: 0ms
memory: 3472kb

input:

3
5
1 2 1 2 1
7
1 2 3 2 1 2 3
8
1 10 10 1 1 100 100 1

output:

2
6
4

result:

ok 3 lines

Test #16:

score: 0
Accepted
time: 134ms
memory: 3512kb

input:

28653
6
372076545 832760265 372076545 644300403 644300403 644300403
8
540046638 375129642 863244619 863244619 375129642 540046638 540046638 540046638
6
142783193 508154499 871683432 71368434 871683432 871683432
8
760894385 984189193 760894385 323542350 984189193 760894385 323542350 323542350
6
84093...

output:

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

result:

ok 28653 lines

Test #17:

score: 0
Accepted
time: 152ms
memory: 3372kb

input:

27269
6
959945170 761436985 26703386 942397980 959945170 26703386
8
547832867 143323747 65089190 143323747 768500236 65089190 143323747 768500236
5
858824238 403652496 456662012 403652496 361827479
7
434065011 434065011 434065011 217272832 959441476 434065011 441896572
7
436828348 383866500 43682834...

output:

6
7
4
5
3
4
6
4
4
4
6
6
4
5
4
5
5
5
4
4
2
5
5
4
5
3
5
4
7
2
4
7
7
6
3
6
4
6
6
4
5
5
5
4
2
3
6
4
4
5
4
5
5
2
4
5
4
5
5
4
5
7
5
3
4
4
6
4
6
3
4
6
3
5
5
5
5
3
6
6
4
2
5
5
7
5
4
6
4
5
3
3
3
4
5
3
5
4
4
4
4
4
5
5
3
5
5
8
5
4
4
3
3
4
6
3
7
6
2
8
5
4
5
5
3
4
4
6
3
5
5
3
6
6
5
5
5
6
7
5
6
4
4
5
5
3
2
6
6
4
...

result:

ok 27269 lines

Test #18:

score: 0
Accepted
time: 117ms
memory: 3424kb

input:

24412
6
37652408 37652408 731951637 684367047 944732733 37652408
6
699823488 800701256 800701256 168169055 800701256 699823488
7
198445595 198445595 25271422 198445595 61301798 198445595 432743062
6
942430095 168670839 942430095 570524923 942430095 570524923
6
500326576 65482727 500326576 809311072 ...

output:

5
4
5
4
4
5
5
5
4
4
6
3
4
5
6
3
5
5
6
5
5
4
6
6
7
5
6
6
5
4
7
4
5
2
5
4
4
6
5
6
6
4
6
5
4
6
6
4
5
7
5
6
5
4
4
5
6
5
4
3
5
5
4
3
5
5
5
6
2
3
5
4
3
5
5
6
3
4
6
5
5
6
5
6
5
4
3
7
6
5
4
3
5
3
6
5
6
4
5
5
7
5
5
4
5
4
7
6
6
4
4
3
4
4
4
4
5
5
4
5
5
2
5
5
5
4
4
6
6
3
6
4
4
6
6
6
5
3
4
4
4
5
4
5
3
4
4
4
7
6
...

result:

ok 24412 lines

Subtask #3:

score: 8
Accepted

Test #19:

score: 8
Accepted
time: 2ms
memory: 3384kb

input:

1
500
537076440 691668159 871942500 537076440 537076440 691668159 871942500 871942500 537076440 691668159 871942500 537076440 691668159 871942500 537076440 691668159 871942500 537076440 691668159 871942500 537076440 691668159 871942500 871942500 537076440 691668159 871942500 537076440 537076440 6916...

output:

361

result:

ok single line: '361'

Test #20:

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

input:

1
500
584142119 101442702 335815880 584142119 101442702 335815880 584142119 101442702 335815880 584142119 101442702 335815880 584142119 101442702 101442702 335815880 335815880 584142119 584142119 101442702 101442702 335815880 584142119 101442702 335815880 584142119 101442702 335815880 584142119 1014...

output:

394

result:

ok single line: '394'

Test #21:

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

input:

1
500
296341737 806184542 989331127 989331127 296341737 806184542 455929030 296341737 806184542 806184542 806184542 989331127 296341737 806184542 989331127 296341737 806184542 989331127 296341737 806184542 989331127 296341737 806184542 806184542 989331127 296341737 296341737 296341737 806184542 9893...

output:

339

result:

ok single line: '339'

Test #22:

score: 0
Accepted
time: 2ms
memory: 3380kb

input:

1
500
361183277 863317163 788070566 361183277 361183277 863317163 788070566 361183277 632739493 788070566 788070566 361183277 863317163 788070566 361183277 863317163 788070566 361183277 863317163 788070566 361183277 863317163 788070566 361183277 863317163 788070566 361183277 863317163 788070566 3611...

output:

353

result:

ok single line: '353'

Test #23:

score: 0
Accepted
time: 2ms
memory: 3400kb

input:

1
500
360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 5755...

output:

423

result:

ok single line: '423'

Test #24:

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

input:

3
68
975239020 470667175 323925950 975239020 470667175 323925950 975239020 470667175 323925950 975239020 470667175 323925950 975239020 470667175 323925950 975239020 470667175 323925950 323925950 323925950 975239020 470667175 323925950 975239020 470667175 323925950 323925950 975239020 470667175 32392...

output:

48
386
3

result:

ok 3 lines

Test #25:

score: 0
Accepted
time: 2ms
memory: 3372kb

input:

3
118
150373656 793064947 635264518 635264518 709296672 793064947 635264518 709296672 709296672 709296672 793064947 635264518 709296672 793064947 635264518 709296672 793064947 793064947 635264518 709296672 793064947 793064947 635264518 709296672 793064947 635264518 709296672 793064947 635264518 7092...

output:

97
230
33

result:

ok 3 lines

Test #26:

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

input:

3
113
89789132 548906728 545868627 545868627 89789132 548906728 545868627 89789132 548906728 545868627 89789132 548906728 545868627 89789132 548906728 545868627 89789132 548906728 545868627 89789132 548906728 545868627 89789132 548906728 545868627 89789132 548906728 545868627 89789132 548906728 5458...

output:

101
127
137

result:

ok 3 lines

Test #27:

score: 0
Accepted
time: 2ms
memory: 3404kb

input:

3
108
794907019 802850140 730657927 730657927 794907019 794907019 802850140 730657927 794907019 802850140 730657927 794907019 794907019 802850140 802850140 730657927 794907019 802850140 730657927 730657927 794907019 802850140 802850140 802850140 802850140 730657927 794907019 802850140 730657927 7306...

output:

78
71
236

result:

ok 3 lines

Test #28:

score: 0
Accepted
time: 2ms
memory: 3524kb

input:

3
55
382906854 86510837 1801762 382906854 86510837 1801762 382906854 382906854 578362690 1801762 382906854 86510837 1801762 382906854 86510837 1801762 1801762 382906854 86510837 1801762 382906854 86510837 1801762 382906854 86510837 1801762 382906854 86510837 382906854 1801762 86510837 382906854 1801...

output:

43
81
289

result:

ok 3 lines

Test #29:

score: 0
Accepted
time: 2ms
memory: 3524kb

input:

20
38
68789463 462582466 279061055 68789463 536943437 279061055 68789463 536943437 279061055 68789463 536943437 279061055 68789463 536943437 279061055 68789463 536943437 279061055 68789463 536943437 279061055 68789463 536943437 279061055 68789463 536943437 279061055 536943437 68789463 279061055 5369...

output:

32
18
20
76
24
7
5
9
5
42
34
25
14
4
10
29
8
16
31
9

result:

ok 20 lines

Test #30:

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

input:

100
8
594931073 674884200 594931073 960542002 674884200 594931073 404937349 674884200
3
28762160 795234252 28762160
6
693736695 693736695 515596726 693736695 568079150 515596726
2
508417829 600345257
4
637967683 731409954 197653780 548314174
9
493559887 493559887 995798571 234632692 493559887 995798...

output:

7
2
4
2
4
7
3
3
3
1
8
1
5
3
1
1
2
5
3
10
3
1
3
6
4
5
5
1
6
2
2
6
9
9
2
7
3
5
8
1
7
11
3
4
3
12
1
1
5
2
4
8
1
1
9
4
1
4
3
14
3
2
1
2
2
3
2
5
4
6
2
9
3
2
5
1
2
9
1
10
3
19
7
2
2
5
1
15
1
1
6
11
1
1
2
1
2
5
8
4

result:

ok 100 lines

Test #31:

score: 0
Accepted
time: 2ms
memory: 3380kb

input:

1
500
3 2 2 3 1 1 1 2 3 2 2 1 3 1 3 3 1 1 3 1 1 2 3 1 1 1 2 2 1 2 1 3 3 2 3 3 2 2 1 2 3 1 2 2 3 3 1 3 3 3 3 3 2 1 2 3 1 3 1 2 1 3 3 1 1 1 1 3 3 1 1 3 3 1 1 1 3 3 2 3 1 1 1 1 1 1 2 1 1 3 1 3 2 1 3 3 1 3 1 1 1 2 3 3 2 1 3 3 3 2 1 3 3 3 1 3 3 1 3 2 2 2 1 1 1 1 3 3 1 2 1 2 2 2 3 3 1 1 1 3 2 3 1 3 3 2 1 ...

output:

162

result:

ok single line: '162'

Test #32:

score: 0
Accepted
time: 1ms
memory: 3380kb

input:

1
500
1 1 1 2 2 1 2 3 2 1 1 3 1 1 1 3 2 3 2 2 1 2 2 3 3 1 3 3 3 2 3 2 2 3 2 3 1 3 1 1 3 2 1 3 3 1 3 2 3 1 3 1 3 2 2 1 1 3 1 2 1 1 1 3 1 2 2 2 2 3 2 3 3 2 1 1 3 2 3 3 3 2 2 2 2 1 1 3 1 1 3 1 3 1 2 1 2 3 2 2 3 1 3 1 1 1 3 3 1 3 3 2 2 1 3 3 1 1 3 1 2 3 3 2 1 2 1 3 1 1 1 2 1 3 1 1 2 1 2 3 3 2 1 3 2 3 2 ...

output:

170

result:

ok single line: '170'

Test #33:

score: 0
Accepted
time: 2ms
memory: 3380kb

input:

1
500
1 3 1 3 1 1 3 1 2 2 1 1 1 1 1 3 3 2 2 3 2 2 1 2 3 1 2 1 3 1 1 1 1 1 3 3 1 3 3 1 1 3 3 3 1 3 1 3 1 2 1 1 2 2 2 1 3 3 2 2 3 3 1 2 3 1 2 3 1 1 1 2 2 1 1 1 2 3 1 3 2 1 1 1 3 3 1 1 1 1 3 2 2 3 3 1 2 2 2 1 3 3 3 1 2 2 1 3 3 2 2 2 1 3 1 2 3 1 2 1 3 3 2 2 2 3 2 1 1 2 1 1 1 1 3 1 3 1 2 1 2 2 2 3 2 1 3 ...

output:

171

result:

ok single line: '171'

Test #34:

score: 0
Accepted
time: 2ms
memory: 3368kb

input:

3
226
2 2 2 3 3 3 3 1 2 1 2 1 3 3 3 2 2 2 1 3 3 3 2 3 3 3 2 2 2 3 3 2 1 2 3 1 3 2 2 3 3 1 2 2 3 1 2 3 1 3 2 1 3 1 2 3 3 3 3 1 3 2 1 3 3 1 1 2 1 3 1 3 1 3 2 2 2 2 1 2 2 2 2 1 2 1 1 3 1 2 2 2 1 2 3 3 1 1 3 3 1 1 2 1 3 3 3 2 3 3 1 3 2 1 2 1 2 3 1 3 3 2 2 2 3 3 3 2 2 3 2 2 1 1 2 2 3 2 2 2 2 3 2 1 2 2 3 ...

output:

81
106
57

result:

ok 3 lines

Test #35:

score: 0
Accepted
time: 2ms
memory: 3268kb

input:

20
23
3 2 3 2 2 1 3 3 1 2 3 1 2 2 2 1 2 1 3 1 1 2 1
19
2 2 3 3 1 2 2 2 3 1 2 3 3 3 1 1 1 2 1
12
2 3 3 2 3 1 3 1 3 2 2 1
39
1 2 1 1 2 2 2 1 2 2 2 1 1 1 3 2 3 1 1 2 1 3 2 2 3 2 2 2 3 1 2 1 3 1 2 1 1 2 1
21
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
24
1 2 3 1 1 1 2 3 1 2 3 2 1 3 3 2 1 3 2 1 3 2 1 3
15
...

output:

10
10
6
11
1
17
6
35
4
2
5
4
3
19
79
22
2
2
5
22

result:

ok 20 lines

Test #36:

score: 0
Accepted
time: 3ms
memory: 3472kb

input:

100
2
1 2
2
1 3
4
2 3 1 2
3
1 1 2
1
3
3
1 2 2
1
3
6
1 2 1 1 3 2
2
3 3
3
3 3 1
5
3 1 3 3 1
1
1
4
3 1 3 3
15
2 3 2 3 2 3 1 3 1 2 2 1 1 1 2
2
3 2
4
2 3 3 3
6
2 2 2 2 1 3
15
1 3 2 1 3 3 1 1 3 3 3 1 2 1 2
4
1 2 3 3
3
2 1 1
9
3 3 3 1 1 2 3 2 1
4
1 1 1 3
11
2 2 3 1 3 2 2 2 2 2 2
5
1 2 1 3 2
4
3 1 3 3
9
3 2...

output:

2
2
4
2
1
2
1
4
1
2
2
1
2
6
2
2
3
7
3
2
5
2
4
4
2
5
4
2
6
5
2
5
2
2
5
5
3
7
6
2
3
2
2
2
1
2
5
2
3
5
2
3
5
7
4
2
2
1
1
15
3
2
3
1
3
1
5
3
2
4
1
2
6
2
5
1
2
4
1
1
1
2
7
2
3
6
1
3
2
4
5
1
2
3
5
1
3
4
2
3

result:

ok 100 lines

Test #37:

score: 0
Accepted
time: 3ms
memory: 3420kb

input:

1
500
455886399 626955833 421163133 892575355 805049331 975659748 741071093 875911704 113500223 113500223 661192282 597935861 597935861 262970158 495955172 153851712 234849549 887929988 887929988 887929988 887929988 542128740 727090845 727090845 685055701 224058754 37318791 519705695 83375459 722649...

output:

469

result:

ok single line: '469'

Test #38:

score: 0
Accepted
time: 2ms
memory: 3408kb

input:

1
500
29435243 925769090 446792611 21667712 789719595 410464435 789287785 96845859 690771702 190228530 64528308 200770249 815748901 521046227 312297467 316401902 401409002 745745759 124319941 371122503 512242376 34813204 305249842 744963641 43370519 348889633 348889633 47719027 937000032 168595842 1...

output:

477

result:

ok single line: '477'

Test #39:

score: 0
Accepted
time: 2ms
memory: 3312kb

input:

1
500
602984088 664773836 177454793 1016966 334198372 285460610 132471773 172555823 678108588 569521673 975831156 698378851 695351143 743016550 389745384 304682329 700880753 700880753 914143778 268616886 223218955 837422858 549920713 672348418 767277498 618713431 61983854 68335376 960714345 60895712...

output:

477

result:

ok single line: '477'

Test #40:

score: 0
Accepted
time: 2ms
memory: 3408kb

input:

1
500
271946887 695308006 271946887 271946887 294535481 695308006 294535481 271946887 271946887 294535481 271946887 695308006 294535481 294535481 271946887 294535481 271946887 695308006 271946887 695308006 294535481 695308006 294535481 271946887 294535481 695308006 294535481 695308006 271946887 6953...

output:

241

result:

ok single line: '241'

Test #41:

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

input:

1
500
720937483 17827429 720937483 971419328 720937483 17827429 971419328 720937483 17827429 720937483 971419328 17827429 720937483 971419328 17827429 971419328 17827429 971419328 720937483 971419328 17827429 720937483 17827429 720937483 971419328 720937483 971419328 720937483 17827429 971419328 178...

output:

232

result:

ok single line: '232'

Test #42:

score: 0
Accepted
time: 2ms
memory: 3396kb

input:

1
500
45706846 591376273 45706846 591376273 45706846 591376273 186758449 45706846 591376273 45706846 591376273 186758449 591376273 186758449 591376273 45706846 186758449 591376273 45706846 186758449 591376273 591376273 186758449 591376273 45706846 591376273 186758449 591376273 186758449 45706846 591...

output:

253

result:

ok single line: '253'

Test #43:

score: 0
Accepted
time: 1ms
memory: 3412kb

input:

1
500
282927666 282927666 484147677 484147677 282927666 484147677 282927666 484147677 282927666 484147677 484147677 282927666 484147677 282927666 484147677 282927666 484147677 282927666 484147677 282927666 484147677 282927666 484147677 484147677 282927666 282927666 484147677 282927666 484147677 2829...

output:

49

result:

ok single line: '49'

Test #44:

score: 0
Accepted
time: 2ms
memory: 3376kb

input:

1
500
151443807 223152423 151443807 223152423 151443807 223152423 151443807 223152423 223152423 151443807 223152423 151443807 223152423 151443807 223152423 151443807 223152423 151443807 223152423 151443807 223152423 151443807 223152423 151443807 223152423 151443807 223152423 151443807 223152423 1514...

output:

14

result:

ok single line: '14'

Test #45:

score: 0
Accepted
time: 2ms
memory: 3452kb

input:

1
500
579768459 816932976 579768459 816932976 579768459 816932976 579768459 579768459 816932976 579768459 327660977 579768459 327660977 327660977 579768459 327660977 579768459 327660977 579768459 327660977 579768459 327660977 579768459 327660977 579768459 327660977 579768459 327660977 327660977 5797...

output:

28

result:

ok single line: '28'

Test #46:

score: 0
Accepted
time: 2ms
memory: 3408kb

input:

1
500
414505640 887314173 414505640 205268028 414505640 887314173 414505640 827649339 887314173 827649339 348309219 827649339 887314173 827649339 348309219 827649339 887314173 827649339 348309219 827649339 887314173 827649339 144164301 887314173 144164301 155363834 144164301 887314173 144164301 7702...

output:

346

result:

ok single line: '346'

Test #47:

score: 0
Accepted
time: 1ms
memory: 3388kb

input:

1
500
671728328 441054685 671728328 645366031 671728328 441054685 671728328 803083316 441054685 803083316 490509277 803083316 441054685 803083316 252342793 441054685 252342793 304397499 252342793 441054685 252342793 211149108 441054685 211149108 83472025 211149108 441054685 211149108 969490582 44105...

output:

331

result:

ok single line: '331'

Test #48:

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

input:

1
500
10771846 877966861 10771846 737001418 10771846 877966861 10771846 737001418 10771846 877966861 10771846 737001418 10771846 877966861 10771846 737001418 10771846 877966861 10771846 737001418 10771846 877966861 10771846 737001418 10771846 877966861 10771846 762757376 877966861 762757376 38921535...

output:

359

result:

ok single line: '359'

Test #49:

score: 0
Accepted
time: 1ms
memory: 3412kb

input:

1
500
259712038 76498306 76498306 259712038 76498306 259712038 76498306 259712038 76498306 259712038 76498306 259712038 76498306 415413414 76498306 415413414 953033042 415413414 953033042 415413414 415413414 953033042 953033042 415413414 953033042 415413414 953033042 415413414 953033042 742889991 74...

output:

61

result:

ok single line: '61'

Test #50:

score: 0
Accepted
time: 2ms
memory: 3416kb

input:

1
500
833260882 375311563 833260882 375311563 833260882 375311563 833260882 375311563 375311563 833260882 833260882 375311563 833260882 375311563 833260882 375311563 833260882 375311563 375311563 833260882 375311563 433607285 375311563 433607285 375311563 433607285 375311563 267102281 375311563 6556...

output:

76

result:

ok single line: '76'

Test #51:

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

input:

1
500
701777023 114316309 701777023 114316309 701777023 114316309 701777023 114316309 701777023 114316309 701777023 701777023 114316309 4578253 114316309 4578253 114316309 114316309 4578253 114316309 4578253 114316309 4578253 114316309 4578253 114316309 4578253 114316309 4578253 114316309 4578253 11...

output:

72

result:

ok single line: '72'

Test #52:

score: 0
Accepted
time: 2ms
memory: 3380kb

input:

1
500
25469206 25469206 212543486 25469206 212543486 25469206 212543486 115107578 212543486 115107578 212543486 115107578 212543486 115107578 115107578 212543486 115107578 212543486 421158058 421158058 212543486 421158058 212543486 421158058 421158058 212543486 421158058 212543486 212543486 42115805...

output:

61

result:

ok single line: '61'

Test #53:

score: 0
Accepted
time: 2ms
memory: 3388kb

input:

1
500
682522770 508839869 682522770 508839869 682522770 508839869 165553515 508839869 165553515 508839869 810406081 508839869 810406081 508839869 165227240 508839869 165227240 508839869 165227240 508839869 165227240 508839869 165227240 508839869 165227240 508839869 165227240 508839869 165227240 5088...

output:

272

result:

ok single line: '272'

Test #54:

score: 0
Accepted
time: 2ms
memory: 3292kb

input:

1
500
409411658 340511656 409411658 340511656 409411658 340511656 409411658 340511656 806492284 885501368 806492284 885501368 806492284 885501368 806492284 885501368 806492284 885501368 806492284 885501368 806492284 885501368 806492284 885501368 806492284 885501368 806492284 885501368 806492284 8855...

output:

124

result:

ok single line: '124'

Test #55:

score: 0
Accepted
time: 2ms
memory: 3376kb

input:

3
94
1 4 3 5 3 4 3 1 7 3 4 1 5 6 4 1 7 6 3 7 5 1 7 6 2 6 5 6 7 5 3 4 7 4 7 4 6 7 2 1 2 2 5 5 1 4 1 6 2 3 1 2 7 4 2 1 2 1 4 7 1 6 2 1 4 3 4 2 3 7 2 7 2 4 1 4 7 1 3 4 6 1 7 1 5 2 5 7 3 7 4 6 2 1
52
1 6 7 7 5 1 7 3 7 3 5 6 7 7 3 6 4 1 6 4 2 2 4 6 5 5 5 6 2 7 5 2 3 1 1 1 3 7 6 4 6 3 2 5 5 7 4 3 7 2 4 2
...

output:

76
37
294

result:

ok 3 lines

Test #56:

score: 0
Accepted
time: 2ms
memory: 3392kb

input:

3
50
1 1 7 5 5 2 7 5 2 7 2 7 5 7 5 3 7 3 3 5 7 5 7 3 7 5 7 3 7 5 7 3 7 3 5 3 5 3 1 1 7 1 1 1 7 3 3 1 7 3
94
7 6 6 7 5 7 6 7 5 5 6 5 7 6 5 6 5 6 5 6 5 6 7 6 7 6 7 6 7 5 7 6 7 5 7 6 7 5 7 5 7 5 6 7 6 5 7 6 5 7 6 6 5 6 5 5 6 7 5 7 6 7 5 6 7 5 6 5 6 7 5 6 5 6 6 5 7 5 6 7 5 7 7 5 7 5 5 7 6 7 6 7 7 6
356
...

output:

28
44
179

result:

ok 3 lines

Test #57:

score: 0
Accepted
time: 2ms
memory: 3396kb

input:

3
139
6 5 6 5 6 5 6 5 5 6 5 6 5 6 5 6 5 6 5 6 6 5 6 5 6 5 6 5 6 5 6 7 6 5 7 5 7 5 7 5 7 5 7 7 5 7 5 7 5 7 5 7 5 7 5 7 7 5 7 7 5 7 5 7 5 7 5 5 7 5 5 5 7 5 7 5 7 5 7 7 5 7 7 5 7 5 7 5 7 5 7 5 5 7 5 7 5 7 5 7 5 7 5 7 5 7 5 7 5 7 5 5 7 5 7 5 7 7 5 7 5 7 5 7 5 7 5 7 5 7 5 5 7 5 7 5 7 5 7
313
1 5 1 5 1 5 ...

output:

6
8
7

result:

ok 3 lines

Test #58:

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

input:

3
190
3 5 3 1 3 5 3 1 3 5 3 1 3 5 3 1 3 5 3 1 3 5 3 1 3 5 3 2 5 2 7 2 5 2 7 2 5 2 7 2 5 2 7 2 5 2 3 5 3 1 3 5 3 1 3 5 3 1 3 5 3 1 3 5 3 1 3 5 3 1 3 5 3 1 3 5 3 2 5 2 7 2 5 2 7 2 5 2 7 2 5 2 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 ...

output:

139
118
101

result:

ok 3 lines

Test #59:

score: 0
Accepted
time: 2ms
memory: 3400kb

input:

3
130
3 2 3 2 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 2 5 2 5 2 5 1 5 1 5 1 5 1 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 6 2 6 2 6 2 6 2 6 2 6 2 2 1 2 1 2 1 2 1 4 1 4 1 4 1 4 1 4 6 4 6 4 6 4 6 5 6 5 6 5 6 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5
74
4 6 6 6 4 6 4 6 4 6 6 4 6 4 4 6...

output:

20
9
51

result:

ok 3 lines

Test #60:

score: 0
Accepted
time: 2ms
memory: 3436kb

input:

3
107
6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 4 7 4 3 4 7 4 1 7 1 5 1 7 1 5 1 7 1 4 7 4 6 4 7 4 7 3 5 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 4 3 4 3 4 3 4 3 4 5 7 5 7 7 3 7 5 7 5 3 5 7 3 5 7 6 1 1 6 7 1 6 1 7 6 1
73
2 3 2 6 2 2 1 2 1 2 1 2 1 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 2 1 6 7 5 6...

output:

57
17
92

result:

ok 3 lines

Test #61:

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

input:

3
146
905971758 240705216 290005132 536589372 460138502 563090429 725778480 26169743 637578914 392036242 235133216 533603958 883176441 883176441 42792325 656076467 933696550 673478376 835737951 748712810 194445723 891601325 555381933 985608038 597901844 939157103 718305152 566848749 594357652 652864...

output:

140
178
158

result:

ok 3 lines

Test #62:

score: 0
Accepted
time: 3ms
memory: 3404kb

input:

3
49
74830278 539516613 74830278 539516613 784024584 74830278 784024584 74830278 784024584 74830278 784024584 539516613 784024584 539516613 784024584 539516613 74830278 539516613 784024584 74830278 784024584 539516613 784024584 539516613 784024584 539516613 784024584 539516613 74830278 784024584 748...

output:

20
143
98

result:

ok 3 lines

Test #63:

score: 0
Accepted
time: 2ms
memory: 3372kb

input:

3
320
662263417 662263417 759212235 662263417 759212235 759212235 662263417 759212235 662263417 759212235 662263417 759212235 662263417 759212235 662263417 759212235 662263417 759212235 662263417 759212235 662263417 759212235 757302985 757302985 662263417 759212235 757302985 662263417 757302985 7573...

output:

42
9
6

result:

ok 3 lines

Test #64:

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

input:

3
66
635958303 572691027 635958303 753983766 635958303 572691027 635958303 753983766 635958303 572691027 635958303 910469217 572691027 910469217 459355619 910469217 572691027 910469217 965777089 572691027 965777089 888016580 965777089 572691027 965777089 888016580 965777089 572691027 965777089 88801...

output:

47
199
90

result:

ok 3 lines

Test #65:

score: 0
Accepted
time: 3ms
memory: 3524kb

input:

3
365
563779268 572686550 746125689 572686550 746125689 572686550 746125689 572686550 746125689 572686550 746125689 572686550 746125689 746125689 572686550 746125689 572686550 84079729 84079729 572686550 84079729 572686550 84079729 406080738 84079729 406080738 84079729 406080738 84079729 406080738 4...

output:

56
12
9

result:

ok 3 lines

Test #66:

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

input:

3
361
595120737 491102101 595120737 491102101 595120737 832860755 595120737 832860755 595120737 832860755 736132025 832860755 832860755 736132025 832860755 736132025 736132025 832860755 736132025 4935212 96717202 336300849 96717202 336300849 501484470 336300849 501484470 336300849 501484470 78987245...

output:

147
4
66

result:

ok 3 lines

Test #67:

score: 0
Accepted
time: 2ms
memory: 3400kb

input:

10
61
26262500 240243187 237605778 28465702 102474829 431061606 310285858 101698003 596018567 698370876 852860590 318488204 489778201 843922819 706993266 409247144 444122524 785662333 54507781 220155124 463482685 415924514 967953100 443774257 534915647 760684187 312341892 294928021 958814839 4706823...

output:

60
5
7
6
47
5
11
33
131
155

result:

ok 10 lines

Test #68:

score: 0
Accepted
time: 1ms
memory: 3332kb

input:

10
6
700522940 296770226 700522940 700522940 738757773 700522940
13
180402080 105717690 979369373 180402080 979369373 105717690 180402080 979369373 105717690 374355075 656232386 656232386 374355075
67
697908824 792580337 697908824 542154874 792580337 697908824 792580337 697908824 235065059 697908824...

output:

4
9
37
24
10
63
83
19
13
10

result:

ok 10 lines

Test #69:

score: 0
Accepted
time: 2ms
memory: 3472kb

input:

10
56
934591892 58329970 934591892 58329970 934591892 58329970 934591892 58329970 934591892 58329970 934591892 58329970 934591892 58329970 52828378 58329970 934591892 52828378 794728475 934591892 52828378 934591892 794728475 52828378 794728475 934591892 52828378 794728475 934591892 52828378 79472847...

output:

23
2
4
11
5
5
5
13
2
2

result:

ok 10 lines

Test #70:

score: 0
Accepted
time: 2ms
memory: 3392kb

input:

10
36
107463914 913609990 107463914 368438061 107463914 913609990 107463914 368438061 107463914 913609990 107463914 511278029 414697574 511278029 575972110 511278029 414697574 511278029 33707345 414697574 33707345 889876537 33707345 414697574 33707345 889876537 33707345 414697574 33707345 285018984 ...

output:

26
50
85
43
15
3
48
4
35
45

result:

ok 10 lines

Test #71:

score: 0
Accepted
time: 3ms
memory: 3484kb

input:

10
18
283112771 436225265 283112771 436225265 283112771 436225265 283112771 436225265 283112771 436225265 283112771 436225265 283112771 436225265 283112771 591466704 283112771 591466704
1
861163789
28
349333071 926730064 349333071 926730064 86207441 926730064 86207441 926730064 86207441 926730064 86...

output:

4
1
7
2
16
2
2
24
2
20

result:

ok 10 lines

Test #72:

score: 0
Accepted
time: 2ms
memory: 3392kb

input:

10
40
583660420 128778708 583660420 418338271 797588694 418338271 418338271 36416458 797588694 418338271 36416458 418338271 609195672 547273127 88921181 915282122 252885739 915282122 915282122 252885739 915282122 252885739 915282122 845921357 315576577 845921357 74770157 79216870 866919853 129145613...

output:

25
30
46
15
3
12
39
11
14
17

result:

ok 10 lines

Test #73:

score: 0
Accepted
time: 1ms
memory: 3360kb

input:

100
1
13230502
6
613065989 209589809 209589809 27485586 951264264 410243397
11
712826200 128754523 499514641 619949545 304091114 595574683 898865435 521720060 115391977 409473053 10001963
11
843849239 576984692 99319972 428828222 290932762 98181009 890551489 185106247 116388923 376464259 964668849
1...

output:

1
5
11
11
10
7
2
3
8
1
1
5
2
2
1
1
5
3
6
2
6
2
4
4
5
9
7
3
1
13
5
6
4
2
1
1
2
3
1
3
1
3
2
3
8
10
3
2
4
4
4
2
2
7
2
1
8
3
2
1
6
11
3
2
6
3
2
5
2
8
1
2
5
20
10
5
5
1
8
13
7
1
10
4
9
2
5
13
7
16
6
3
8
2
4
1
6
2
1
5

result:

ok 100 lines

Test #74:

score: 0
Accepted
time: 3ms
memory: 3360kb

input:

100
2
800872870 982239765
24
59122782 536038598 59122782 59122782 268124857 247528547 59122782 247528547 268124857 59122782 268124857 268124857 210119477 247528547 268124857 247528547 268124857 268124857 268124857 210119477 247528547 210119477 247528547 268124857
3
924271158 328390958 670114185
4
69...

output:

2
13
3
3
6
5
4
1
2
2
2
4
1
2
2
6
3
1
2
1
3
4
1
2
4
2
2
2
2
2
1
7
2
2
1
3
8
4
5
5
4
8
10
17
3
4
4
2
4
4
3
3
3
2
1
1
1
6
4
1
1
6
6
5
9
8
2
1
2
3
2
2
2
2
2
2
6
3
6
2
4
2
2
1
5
1
6
2
2
1
1
4
2
4
2
2
3
2
3
5

result:

ok 100 lines

Test #75:

score: 0
Accepted
time: 2ms
memory: 3384kb

input:

100
4
783340795 310809792 783340795 310809792
5
119722408 47065596 119722408 47065596 119722408
3
880830920 535205516 880830920
1
248474769
14
653960744 455546860 653960744 455546860 653960744 455546860 653960744 653960744 455546860 653960744 455546860 653960744 653960744 455546860
2
103385893 71602...

output:

2
2
2
1
2
2
2
2
2
2
2
2
4
1
2
2
2
4
2
2
2
1
1
2
1
2
2
2
2
2
2
2
2
2
2
1
1
2
2
2
2
4
2
1
2
2
2
5
2
2
5
2
2
2
2
2
2
2
2
1
2
2
2
1
2
2
1
2
2
2
2
1
2
3
2
2
1
5
2
2
2
2
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2

result:

ok 100 lines

Test #76:

score: 0
Accepted
time: 3ms
memory: 3276kb

input:

100
8
653040023 272349230 566423990 821901787 977088214 977088214 585105781 182463393
2
138672826 237919522
2
478558926 312699166
6
472471053 194597476 739853989 739853989 466984027 544388286
4
96354375 968990285 741582104 786470599
3
582931827 597819817 951992025
6
300035070 757113713 712710617 601...

output:

7
2
2
5
4
3
5
2
6
2
2
2
4
6
4
2
4
5
2
3
1
7
10
7
3
1
5
4
2
4
6
5
2
1
1
5
3
16
3
3
15
4
3
6
12
1
4
3
6
1
1
1
1
1
3
1
3
7
5
1
14
14
5
14
8
5
11
3
4
12
13
3
1
2
6
1
10
6
6
4
8
8
7
5
5
2
3
2
3
4
1
5
3
1
4
4
4
4
1
3

result:

ok 100 lines

Test #77:

score: 0
Accepted
time: 2ms
memory: 3516kb

input:

100
1
653986630
7
78293455 81369374 78293455 140941205 78293455 78293455 140941205
1
353165852
8
217304646 79414 217304646 79414 217304646 79414 217304646 312122830
3
230131296 814455042 230131296
3
278976992 410137720 278976992
9
456114454 655155254 456114454 655155254 220030737 655155254 220030737...

output:

1
4
1
3
2
2
4
2
2
2
1
3
3
2
2
2
3
3
1
2
3
1
2
2
1
2
2
1
2
2
2
2
2
2
1
4
2
2
2
2
2
2
2
2
4
1
2
1
3
2
2
2
2
2
2
2
2
2
5
2
11
2
1
2
2
4
2
2
2
2
1
2
2
2
2
2
2
3
2
2
2
2
2
4
2
2
2
2
1
2
2
8
3
2
1
2
1
2
2
6

result:

ok 100 lines

Test #78:

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

input:

100
5
887163735 579534916 530441529 430846330 923345818
1
810929256
6
890875426 890875426 657094919 890875426 657094919 890875426
6
546280728 232809358 687997147 232809358 687997147 232809358
8
763532350 892527595 787186795 539587226 963903850 175053045 692102911 159230362
3
116924919 841116202 7753...

output:

5
1
2
3
8
3
3
6
2
5
5
1
3
1
1
1
7
1
3
2
1
5
5
2
6
2
2
2
9
1
15
2
1
2
8
1
1
1
4
1
7
8
5
2
3
3
6
1
3
5
3
5
2
8
4
7
11
13
4
2
5
6
6
3
3
1
3
4
12
5
2
1
3
1
2
2
3
1
5
5
2
6
11
4
9
2
5
5
2
3
5
2
2
2
11
2
10
6
1
5

result:

ok 100 lines

Subtask #4:

score: 10
Accepted

Test #79:

score: 10
Accepted
time: 23ms
memory: 11944kb

input:

1
200000
1 3 3 2 2 3 3 1 2 3 1 1 3 3 3 2 1 1 2 3 2 1 3 3 3 1 2 2 1 3 1 2 1 2 3 2 3 3 2 2 3 2 3 2 3 1 1 1 1 1 3 1 3 2 3 3 3 3 1 3 2 1 3 2 3 2 3 1 1 1 1 3 3 2 3 2 1 2 2 3 2 3 2 2 2 2 2 2 3 2 1 2 2 1 1 3 2 1 2 1 1 3 3 3 2 1 2 2 2 1 3 3 2 3 2 1 3 3 2 2 1 3 1 3 2 1 2 3 2 1 2 3 2 2 3 2 1 2 1 1 1 1 1 1 1 3...

output:

66691

result:

ok single line: '66691'

Test #80:

score: 0
Accepted
time: 40ms
memory: 11968kb

input:

1
200000
2 2 3 3 3 2 1 2 1 1 1 3 3 2 3 3 1 3 2 3 3 3 2 1 2 2 2 2 1 1 2 2 1 3 1 3 1 3 3 1 2 1 1 2 1 1 2 1 1 1 1 2 2 1 3 2 3 3 2 3 2 3 1 1 1 1 2 3 1 2 1 1 2 3 2 3 3 2 1 2 1 1 3 3 3 1 2 3 1 3 1 3 1 1 2 1 3 2 1 1 3 2 1 1 3 2 3 2 3 2 1 3 2 2 2 1 2 2 1 3 3 1 3 1 2 3 1 1 2 2 2 1 3 1 1 3 3 2 3 2 1 3 1 1 1 3...

output:

66403

result:

ok single line: '66403'

Test #81:

score: 0
Accepted
time: 31ms
memory: 11960kb

input:

1
200000
1 2 3 3 1 2 3 3 1 2 3 1 1 2 3 1 2 3 1 2 2 3 1 2 2 3 3 3 1 2 3 3 1 2 3 3 1 1 2 2 3 3 1 2 3 3 1 1 2 3 1 2 2 3 3 1 2 3 1 1 1 1 2 3 3 1 2 2 3 1 1 1 2 2 3 3 1 1 1 2 2 3 1 1 2 3 3 1 1 2 3 1 2 3 1 2 3 3 1 1 2 3 1 1 1 1 2 3 1 2 3 3 1 2 2 2 2 2 3 1 1 2 3 1 2 2 3 1 2 3 3 1 2 2 3 1 2 3 1 1 1 2 2 3 1 2...

output:

113082

result:

ok single line: '113082'

Test #82:

score: 0
Accepted
time: 28ms
memory: 11940kb

input:

1
200000
2 3 3 1 2 2 2 3 1 1 2 3 1 2 2 3 3 1 2 3 3 3 3 3 3 1 2 3 1 2 3 3 1 2 2 3 3 1 2 3 3 3 1 2 2 3 3 3 1 2 2 3 3 3 3 3 1 1 2 3 1 2 3 3 1 1 2 2 3 1 1 1 1 2 3 1 2 2 3 3 3 1 2 3 1 1 2 2 3 1 1 1 1 2 2 3 3 3 3 1 1 2 3 1 2 3 1 1 1 2 3 3 1 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 2 3 3 1 2 2 3 3 1 1 1 2 2 3 1 1 1 2...

output:

98984

result:

ok single line: '98984'

Test #83:

score: 0
Accepted
time: 39ms
memory: 11964kb

input:

1
200000
3 2 2 2 1 1 2 2 2 1 3 2 3 3 3 1 3 1 3 3 2 1 1 2 1 2 3 2 2 3 1 3 3 2 3 2 3 3 3 2 3 2 3 3 3 3 1 2 3 2 2 1 1 2 3 1 3 1 1 2 1 2 1 1 1 3 3 1 3 2 2 2 1 1 2 3 3 3 1 3 3 3 1 3 2 2 1 3 3 1 3 3 1 3 3 1 3 1 1 1 3 2 3 1 3 1 3 3 3 2 2 2 3 3 2 1 2 1 3 3 2 1 1 3 1 2 2 1 3 1 2 2 3 2 1 2 2 1 3 2 3 3 3 1 1 2...

output:

66809

result:

ok single line: '66809'

Test #84:

score: 0
Accepted
time: 42ms
memory: 11948kb

input:

1
200000
3 1 3 1 3 1 2 1 2 2 3 1 3 2 3 1 1 3 1 3 2 3 3 3 3 1 1 1 2 2 1 1 3 1 2 2 2 1 2 1 1 2 3 2 2 1 3 2 2 2 3 1 1 2 3 1 3 2 1 1 3 1 1 3 1 2 3 1 2 1 2 1 1 1 3 1 1 1 1 3 2 1 2 3 3 2 2 3 1 1 2 1 1 2 1 3 1 3 3 1 1 1 1 1 3 2 3 2 3 1 3 2 1 3 1 3 2 1 1 1 3 2 1 1 3 1 3 3 3 2 2 3 1 3 1 1 3 3 3 2 1 3 3 1 1 1...

output:

66929

result:

ok single line: '66929'

Test #85:

score: 0
Accepted
time: 32ms
memory: 12060kb

input:

1
200000
1 2 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 2 3 1 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 3 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 2 3 1 1 2 2 3 1 2 3 1 2 3 1 2 3 1 1...

output:

165153

result:

ok single line: '165153'

Test #86:

score: 0
Accepted
time: 21ms
memory: 12124kb

input:

1
200000
3 1 2 3 1 2 3 1 2 3 3 1 2 2 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 2...

output:

161302

result:

ok single line: '161302'

Test #87:

score: 0
Accepted
time: 26ms
memory: 10104kb

input:

3
14732
1 3 2 1 3 3 1 1 3 2 1 2 1 1 1 3 1 3 1 1 3 2 1 1 3 2 3 3 2 1 3 3 3 3 1 1 1 2 3 2 1 3 3 3 1 2 1 1 3 1 1 2 2 1 3 3 3 2 3 2 1 2 2 3 1 3 3 2 2 3 1 2 1 1 3 2 2 2 1 2 3 3 1 3 3 2 1 1 1 1 2 1 3 1 2 3 3 2 2 1 3 3 3 2 2 2 1 1 1 1 1 2 1 2 1 3 2 2 1 3 2 3 2 3 3 1 3 1 1 2 1 1 2 1 1 3 2 1 2 3 2 1 3 1 3 3 ...

output:

4957
130118
23430

result:

ok 3 lines

Test #88:

score: 0
Accepted
time: 37ms
memory: 8344kb

input:

3
46973
1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 ...

output:

35431
19615
37542

result:

ok 3 lines

Test #89:

score: 0
Accepted
time: 32ms
memory: 8452kb

input:

3
19336
2 3 1 2 2 3 1 1 2 3 3 1 2 2 2 3 3 3 1 2 3 1 2 2 3 3 3 1 1 1 1 1 2 2 3 3 3 3 1 1 1 2 2 2 2 3 1 1 1 1 2 2 2 3 3 3 3 1 1 2 2 2 3 1 2 3 1 2 2 3 3 3 1 2 3 1 2 3 1 2 3 3 1 1 2 3 3 1 2 2 2 2 2 2 3 3 1 2 3 1 2 2 3 3 1 1 1 1 2 3 1 1 1 1 1 2 2 2 2 2 2 3 3 3 1 2 3 1 2 3 3 1 2 3 3 3 3 3 3 1 2 2 2 2 2 2 ...

output:

8087
53502
40182

result:

ok 3 lines

Test #90:

score: 0
Accepted
time: 32ms
memory: 8060kb

input:

3
111453
2 3 2 2 3 2 2 2 1 1 1 2 2 2 3 2 2 1 3 1 3 3 1 3 2 2 1 3 1 2 2 2 3 1 3 2 1 2 1 1 3 3 1 1 3 1 1 2 1 2 1 1 1 3 3 3 1 1 1 3 2 2 1 3 2 1 1 3 1 2 3 3 1 2 2 2 1 3 2 2 2 2 2 2 2 3 2 1 3 1 2 1 3 1 1 1 2 3 3 1 3 2 1 3 2 2 2 3 1 3 3 3 2 1 3 2 1 3 2 1 3 3 3 1 1 2 1 2 1 3 2 2 2 3 3 1 2 1 2 2 3 3 2 2 2 2...

output:

37432
9380
2

result:

ok 3 lines

Test #91:

score: 0
Accepted
time: 18ms
memory: 11944kb

input:

1
200000
1 2 3 1 2 3 1 2 3 3 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2...

output:

161232

result:

ok single line: '161232'

Test #92:

score: 0
Accepted
time: 29ms
memory: 12120kb

input:

1
200000
2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2...

output:

177380

result:

ok single line: '177380'

Test #93:

score: 0
Accepted
time: 30ms
memory: 12096kb

input:

1
200000
3 2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 2 1 3 2 1 3 2 1 3 2 2 1 3 2 1 3 3 2 2 1 3 2 1 3 2 1 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 2 1 3 2 1 3 2 1 1 3 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 3 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1...

output:

152945

result:

ok single line: '152945'

Test #94:

score: 0
Accepted
time: 28ms
memory: 11972kb

input:

1
200000
3 2 1 3 1 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 3 2 1 3 2 1 3 3 3 3 3 2 2 1 3 2 1 3 3 2 1 3 2 2 1 3 2 1 3 2 1 3 3 2 1 3 2 1 1 3 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 3 2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 3 2 1 3 2 1 1 3 2 2 1 3 2 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 3 2 1 3 2 2 1 3 2 1 3 2...

output:

139711

result:

ok single line: '139711'

Test #95:

score: 0
Accepted
time: 32ms
memory: 11968kb

input:

1
200000
2 3 3 1 2 3 1 2 2 1 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 2 3 1 2 3 1 2 3 3 1 2 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 1 2 3...

output:

159913

result:

ok single line: '159913'

Test #96:

score: 0
Accepted
time: 34ms
memory: 12012kb

input:

1
200000
3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 2 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 1 2 2 3 1 2 3 1 2 3 1 2 3 1 1 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 3 1 2 2 3 1 2 3 1 2 2 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 2 2 3 1...

output:

164070

result:

ok single line: '164070'

Test #97:

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

input:

1
200000
1 3 2 1 3 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 3 2 1 3 2 2 1 3 3 2 2 1 3 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 2 2 2 1 3 2 1 1 3 3 2 1 3 2 1 3 2 1 3 2 1 3 3 2 1 3 2 1 3 2 1 3 3 2 1 1 3 2 1 3 2 1 1 3 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 1 3...

output:

141972

result:

ok single line: '141972'

Test #98:

score: 0
Accepted
time: 27ms
memory: 11908kb

input:

1
200000
1 3 2 1 3 2 1 3 2 1 3 2 2 1 3 3 2 2 1 3 2 1 3 2 1 3 2 1 3 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 3 2 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2...

output:

180569

result:

ok single line: '180569'

Test #99:

score: 0
Accepted
time: 31ms
memory: 8532kb

input:

3
67258
1 3 2 1 3 3 2 1 3 2 1 1 3 2 1 3 2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 2 1 3 2 2 1 3 2 1 3 2 1 3 2 2 1 3 2 1 3 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 2 1 3 2 1 ...

output:

55713
10294
102575

result:

ok 3 lines

Test #100:

score: 0
Accepted
time: 21ms
memory: 8116kb

input:

3
110746
2 3 1 2 3 1 2 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 1 2 3 3 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 1 2 3 3 1 2 3 1 2 3 1 2 3 1 1 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2...

output:

78787
56073
17413

result:

ok 3 lines

Test #101:

score: 0
Accepted
time: 35ms
memory: 7344kb

input:

3
88522
1 2 2 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 3 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 2 3 1 2 3 3 1 2 2 3 1 2 3 1 2 3 1 1 2 3 1 2 2 3 1 2 3 3 1 2 3 3 1 2 3 3 1 2 2 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 1 2 3 3 1 1 1 2 3 1 2 3 1 ...

output:

72954
15040
67627

result:

ok 3 lines

Test #102:

score: 0
Accepted
time: 22ms
memory: 7356kb

input:

3
38399
2 1 1 3 2 1 3 2 1 3 3 3 2 1 3 2 1 3 3 2 2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 3 2 1 3 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 3 2 1 1 1 3 2 1 3 2 1 3 3 3 2 2 2 1 3 2 1 3 3 2 1 1 1 3 2 1 3 2 1 3 2 2 1 3 2 2 1 3 2 1 3 2 1 3 2 ...

output:

27852
58832
74901

result:

ok 3 lines

Test #103:

score: 0
Accepted
time: 34ms
memory: 6368kb

input:

10
23759
3 2 1 2 1 2 1 2 2 2 2 1 1 1 3 1 3 1 3 3 2 1 1 3 3 2 3 2 2 1 3 2 3 3 2 1 3 1 2 3 3 3 2 1 1 3 3 1 2 3 3 2 3 3 1 2 3 3 2 2 1 2 3 2 3 1 1 3 3 3 2 3 3 3 1 1 3 2 3 2 2 3 2 1 1 1 1 2 1 3 3 1 3 2 3 3 1 3 3 1 1 2 3 1 3 2 3 3 2 2 3 1 3 3 2 3 1 3 2 3 3 3 1 2 3 2 3 1 3 1 3 2 2 3 3 2 1 2 2 2 3 1 2 2 2 2...

output:

8049
15976
3898
1817
4647
15431
43707
2827
2372
17780

result:

ok 10 lines

Test #104:

score: 0
Accepted
time: 30ms
memory: 5068kb

input:

15
3978
2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 3 1 2 2 2 3 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 1 1 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 2 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 1 1 2 3 3 3 1 2 3 1 ...

output:

2648
2
12485
3542
2427
2686
13541
17826
1973
10284
16751
13183
2992
4312
643

result:

ok 15 lines

Test #105:

score: 0
Accepted
time: 37ms
memory: 4696kb

input:

20
2162
3 2 3 1 2 2 3 3 1 1 1 2 2 2 3 3 2 2 1 3 2 1 3 3 3 3 2 1 2 1 1 1 3 1 1 2 2 1 2 3 3 2 3 1 1 1 1 3 3 1 3 3 1 1 2 3 3 1 2 2 3 3 2 3 2 3 3 2 2 2 1 1 3 3 2 2 1 3 3 2 3 3 1 1 3 2 2 2 1 2 3 1 3 3 3 1 2 2 2 1 1 1 2 2 3 1 1 3 3 1 3 2 3 1 1 1 2 1 3 1 3 3 2 1 1 2 1 1 3 1 1 2 2 3 2 2 2 1 3 3 3 3 3 2 1 1 ...

output:

754
605
5276
265
12917
210
69
4263
11833
610
2550
5415
3601
12242
4287
5965
1729
16708
1764
1028

result:

ok 20 lines

Test #106:

score: 0
Accepted
time: 34ms
memory: 4336kb

input:

50
3286
2 3 1 2 2 1 2 1 2 2 1 1 2 3 2 3 3 1 3 1 1 1 1 3 3 1 3 3 3 1 2 2 2 2 1 1 1 2 3 1 2 1 2 1 2 3 1 3 1 1 1 1 2 1 3 1 2 2 1 2 1 2 3 3 1 2 1 2 1 2 1 2 2 2 2 2 1 2 3 1 2 1 1 3 2 3 1 1 3 2 1 2 1 1 1 2 2 3 1 1 3 1 1 2 2 3 1 2 2 3 2 3 3 2 1 2 3 3 2 3 1 3 2 2 2 3 3 3 1 2 3 3 3 3 2 3 2 1 2 1 2 1 3 1 2 3 ...

output:

1094
2039
1266
311
3566
734
3452
921
6366
1785
1886
46
250
1156
2209
480
856
891
1475
1903
98
1610
6239
2069
1169
4200
1325
2769
31
956
206
4259
6816
2833
474
3248
818
2818
1
398
160
54
1866
4308
3127
5468
1697
282
1209
1567

result:

ok 50 lines

Test #107:

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

input:

100
1
2
8738
3 3 3 2 2 3 2 1 1 2 2 2 3 2 2 1 1 3 2 2 3 2 3 1 3 3 1 3 2 2 1 1 3 2 1 1 3 1 1 1 1 2 2 2 2 1 3 3 2 2 1 2 1 2 1 1 2 2 1 1 2 2 1 2 3 1 1 3 2 2 1 1 3 1 2 3 2 1 3 1 1 1 3 2 1 3 3 3 2 3 3 3 1 2 1 3 3 1 2 3 2 1 3 3 3 3 1 1 3 2 1 1 2 2 2 2 2 1 3 1 2 3 3 3 2 1 3 3 1 3 2 3 2 1 2 3 1 1 2 2 3 3 2 2...

output:

1
2913
447
199
486
258
178
1822
6779
5048
3183
250
179
1857
719
194
98
510
6409
137
388
186
2
85
705
90
155
2627
766
203
413
550
1863
1
515
97
475
1
21
1282
1064
2382
471
276
557
137
112
225
185
921
1869
4
1877
84
353
1369
1175
717
2
507
1358
328
762
525
239
223
49
189
621
1229
427
911
830
2306
3726...

result:

ok 100 lines

Test #108:

score: 0
Accepted
time: 38ms
memory: 3776kb

input:

200
799
2 2 1 1 2 3 3 2 2 2 2 2 1 2 3 3 2 3 3 3 1 3 1 1 2 3 1 3 1 1 3 2 1 3 3 1 3 2 1 1 3 3 1 3 2 1 2 3 3 2 3 3 2 1 2 1 2 2 3 2 1 1 2 1 1 1 1 3 1 2 2 1 3 3 3 3 3 3 2 1 1 3 2 1 2 1 3 1 1 2 3 1 1 1 2 1 1 1 1 1 2 2 3 2 1 2 2 2 2 1 1 3 2 3 2 2 2 2 2 3 2 3 2 2 2 3 2 1 3 3 2 2 3 1 2 2 1 1 1 2 3 1 2 1 3 2 ...

output:

272
219
2
866
1052
234
752
479
66
608
263
503
2073
36
231
1498
315
29
116
514
589
168
905
15
985
18
148
657
2668
1219
580
210
1025
6
41
552
565
181
1702
386
371
154
25
268
2
466
75
151
26
1010
92
700
2157
594
2
1081
168
801
197
157
41
211
902
499
1177
465
101
95
142
500
616
200
51
244
172
630
83
918...

result:

ok 200 lines

Test #109:

score: 0
Accepted
time: 33ms
memory: 3488kb

input:

500
34
2 2 2 2 2 3 3 3 1 2 3 3 1 1 1 2 1 1 3 3 3 3 2 1 3 2 2 2 1 1 3 3 2 1
7
2 1 2 1 1 2 2
333
3 2 1 2 1 1 3 1 1 2 1 2 3 3 3 2 2 1 1 1 1 2 1 3 1 3 1 2 2 2 2 1 3 1 3 3 1 2 3 2 3 1 3 3 3 2 3 1 2 2 1 1 2 3 2 2 3 2 1 3 1 2 1 1 3 1 3 1 2 1 2 2 3 1 1 3 2 2 2 3 2 1 3 1 2 1 3 3 1 3 3 2 2 2 3 2 1 1 3 2 2 3 1...

output:

14
2
124
74
641
27
298
259
91
99
36
568
75
34
164
52
380
59
264
168
88
218
31
89
123
277
23
178
52
439
189
2
162
411
68
1733
348
2
52
354
38
265
10
179
2
80
222
46
298
207
69
547
83
77
117
110
19
414
237
97
111
88
89
36
139
214
266
429
37
629
129
169
42
22
4
84
91
32
231
43
141
168
336
49
40
248
6
4...

result:

ok 500 lines

Test #110:

score: 0
Accepted
time: 33ms
memory: 3424kb

input:

1000
294
3 3 1 1 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 1 2 2 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 3 1 2 3 1 1 2 3 1 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3...

output:

259
87
166
81
32
102
157
101
53
79
126
39
20
50
17
82
23
41
21
70
95
1
14
38
4
116
52
243
21
136
55
1
1
127
12
59
86
52
106
223
12
6
223
23
12
166
50
11
2
152
51
220
13
59
53
10
174
94
14
333
11
70
89
7
111
5
178
31
89
81
44
25
70
449
7
180
45
122
134
113
138
41
2
1
93
59
21
11
113
55
43
100
12
103
...

result:

ok 1000 lines

Test #111:

score: 0
Accepted
time: 81ms
memory: 3368kb

input:

10000
99
2 3 3 1 2 3 3 3 1 2 3 1 2 3 3 3 1 2 2 2 3 1 2 3 1 1 2 3 1 2 2 3 1 2 3 3 1 2 2 2 2 3 1 2 3 3 3 1 2 2 3 1 2 3 3 3 3 1 2 3 1 2 2 2 3 1 1 2 3 1 2 3 3 3 1 2 3 1 2 2 3 3 3 3 1 1 1 1 1 1 2 2 2 3 3 3 1 1 2
9
3 1 2 3 3 1 2 1 3
50
3 3 1 2 3 2 1 3 2 1 3 2 1 3 3 2 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 2 2 ...

output:

61
7
40
60
3
5
1
1
6
2
6
6
1
16
2
14
1
4
3
1
15
5
14
15
3
26
2
5
12
23
5
3
2
9
4
4
2
40
8
25
8
14
5
11
4
11
8
7
2
12
3
4
10
22
16
4
40
2
8
32
24
8
27
22
37
1
2
3
7
15
2
8
6
12
22
4
9
7
12
8
12
3
25
12
5
6
7
6
17
8
6
8
13
2
22
32
5
16
2
4
5
1
5
2
19
2
6
19
28
3
2
2
10
25
17
10
8
4
2
12
7
15
5
5
32
14...

result:

ok 10000 lines

Test #112:

score: 0
Accepted
time: 85ms
memory: 3376kb

input:

20000
9
3 3 2 3 2 2 3 1 2
9
1 1 1 2 2 3 3 2 3
5
2 3 2 1 1
6
2 2 1 2 3 1
7
2 2 2 2 1 3 3
1
1
8
2 1 3 2 2 1 3 2
14
3 3 1 3 2 3 3 1 3 1 3 3 2 3
5
1 2 1 1 1
5
3 2 1 1 2
9
3 2 1 1 1 2 3 1 3
7
1 1 2 3 1 1 1
1
2
5
3 2 1 1 2
29
3 1 1 2 2 1 1 2 3 3 3 1 1 3 2 1 2 3 3 1 3 3 2 3 1 3 3 1 2
6
3 3 1 2 3 1
12
2 3 1...

output:

4
3
3
4
3
1
7
7
2
3
5
4
1
3
12
5
5
8
17
2
2
27
8
10
51
11
4
14
2
3
7
10
6
2
2
4
4
5
5
18
7
1
6
3
2
2
3
2
7
3
5
4
9
1
3
2
1
25
5
9
2
4
4
5
6
2
3
1
2
2
8
2
4
1
20
5
6
1
2
5
2
7
1
3
2
1
6
9
10
4
2
6
16
2
2
1
1
5
11
4
5
4
1
11
1
6
6
14
2
3
8
2
11
12
4
3
14
25
18
2
2
4
16
6
4
3
9
3
1
3
2
5
9
15
5
18
5
6
...

result:

ok 20000 lines

Test #113:

score: 0
Accepted
time: 99ms
memory: 3376kb

input:

50000
5
3 1 3 2 2
1
1
1
3
6
2 1 1 3 3 2
9
3 3 1 1 2 1 3 2 3
1
2
8
2 2 2 2 3 3 2 1
2
1 2
2
3 2
2
2 1
1
1
2
1 3
3
1 3 2
6
3 1 1 1 1 3
4
2 2 2 3
6
1 1 1 2 1 1
3
3 3 1
15
2 3 1 2 3 1 2 3 1 3 2 1 3 2 2
1
3
4
2 1 3 2
2
1 2
4
1 1 2 1
2
2 1
2
1 3
1
2
5
3 3 2 2 1
5
2 3 3 2 3
3
2 2 1
1
2
6
2 3 3 3 3 2
3
2 1 3...

output:

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

result:

ok 50000 lines

Test #114:

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

input:

1
10000
2 3 3 1 2 2 2 3 1 1 2 2 3 3 3 1 2 3 3 1 2 3 3 1 1 2 3 1 1 1 1 2 2 3 3 1 2 2 3 1 1 2 3 1 1 1 1 2 2 2 3 3 3 1 1 2 3 1 2 3 1 1 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 1 1 1 1 1 2 3 1 2 2 2 3 3 1 2 3 3 3 1 1 1 2 3 1 2 3 1 2 2 2 3 1 2 3 1 2 3 1 1 1 2 3 3 1 2 2 2 3 3 1 2 3 3 3 3 3 1 2 2 2 3 1 2 ...

output:

4765

result:

ok single line: '4765'

Test #115:

score: 0
Accepted
time: 1ms
memory: 3692kb

input:

1
10000
1 1 2 2 1 2 1 3 1 3 3 3 3 1 3 1 1 1 1 2 1 3 3 1 2 3 2 3 2 3 1 3 1 3 1 1 1 2 1 1 1 3 3 3 2 1 2 1 3 2 1 3 2 2 1 3 1 2 2 2 2 1 2 2 3 2 2 3 3 2 2 3 2 1 3 3 1 3 3 3 3 1 3 1 1 3 1 3 2 3 3 3 3 3 2 3 3 1 1 3 1 2 2 2 3 1 1 1 2 1 3 2 2 1 1 2 1 3 2 1 2 3 3 2 2 3 3 3 3 1 2 1 3 2 3 2 2 1 1 1 2 2 2 1 1 2 ...

output:

3368

result:

ok single line: '3368'

Test #116:

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

input:

3
2025
1 3 3 1 2 3 1 1 1 2 2 1 2 2 1 2 3 3 2 1 2 3 1 1 2 1 1 1 2 2 2 1 3 1 1 2 3 1 1 3 3 3 2 2 2 2 2 2 1 2 3 1 3 3 2 2 2 3 1 3 3 3 3 3 2 3 1 2 1 3 3 1 3 3 3 1 2 3 2 3 2 2 3 1 1 1 1 3 2 2 3 3 1 1 2 1 3 1 1 3 1 2 2 1 1 2 1 3 2 2 3 1 1 2 1 3 1 2 3 1 3 2 2 3 3 1 3 2 3 2 1 2 2 3 1 3 2 2 1 3 1 1 3 1 2 2 2...

output:

694
953
2972

result:

ok 3 lines

Test #117:

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

input:

20
518
3 3 2 1 1 1 3 1 3 2 1 3 1 2 1 1 3 3 2 3 1 3 1 1 2 1 3 3 2 1 3 2 2 1 3 1 2 3 3 1 2 1 3 1 2 3 3 1 1 2 2 1 3 1 3 2 2 1 2 2 3 1 2 2 2 1 3 3 3 3 1 1 3 3 3 3 1 1 1 2 2 2 3 3 1 3 3 1 1 3 3 2 2 3 3 3 2 3 2 1 1 3 1 3 2 3 2 2 2 1 2 2 1 1 3 2 1 1 3 1 2 3 2 1 3 2 2 1 3 2 1 2 3 2 1 2 2 2 3 1 1 2 2 3 2 3 3...

output:

175
118
279
482
208
59
2
210
44
352
188
87
364
62
155
134
10
1860
418
227

result:

ok 20 lines

Test #118:

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

input:

100
75
2 1 1 3 3 3 2 1 2 3 1 3 1 2 3 1 1 3 2 2 2 3 1 3 2 1 2 3 2 2 1 1 3 1 1 3 3 2 1 2 3 3 1 1 2 2 3 2 1 2 3 3 1 3 1 3 1 2 3 1 3 2 2 2 2 3 1 2 3 3 3 3 1 2 2
130
3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3...

output:

34
114
22
85
85
8
102
19
93
18
30
41
60
17
2
91
204
35
35
16
64
3
2
20
18
27
17
29
47
31
13
11
10
13
36
4
117
22
1
65
13
2
6
24
106
67
1
64
33
206
1
45
14
2
32
304
74
2
21
5
68
25
53
18
93
55
2
54
109
20
25
163
130
35
35
23
9
113
30
77
108
203
18
9
33
47
9
1
44
33
3
204
98
158
3
173
254
3
59
20

result:

ok 100 lines

Test #119:

score: 0
Accepted
time: 3ms
memory: 3820kb

input:

1
10000
2 2 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 ...

output:

7601

result:

ok single line: '7601'

Test #120:

score: 0
Accepted
time: 1ms
memory: 3816kb

input:

1
10000
1 2 3 1 2 2 1 2 2 3 1 1 2 3 3 1 2 3 1 2 3 3 1 1 2 3 1 2 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 2 2 3 1 2 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 2 3 1 2 2 3 1 2 3 ...

output:

7746

result:

ok single line: '7746'

Test #121:

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

input:

1
10000
3 2 3 3 2 1 3 2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 3 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 ...

output:

8313

result:

ok single line: '8313'

Subtask #5:

score: 10
Accepted

Dependency #4:

100%
Accepted

Test #122:

score: 10
Accepted
time: 50ms
memory: 11976kb

input:

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

output:

166092

result:

ok single line: '166092'

Test #123:

score: 0
Accepted
time: 40ms
memory: 12060kb

input:

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

output:

150827

result:

ok single line: '150827'

Test #124:

score: 0
Accepted
time: 48ms
memory: 11972kb

input:

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

output:

178728

result:

ok single line: '178728'

Test #125:

score: 0
Accepted
time: 32ms
memory: 11964kb

input:

1
200000
4 7 1 7 1 1 7 4 7 4 1 7 4 1 7 1 4 7 1 7 7 1 1 7 4 4 7 4 7 1 4 7 4 1 7 7 1 4 1 7 1 7 7 4 1 4 4 4 1 4 7 4 7 1 7 1 7 1 7 4 1 7 4 7 4 7 4 7 1 4 1 4 7 7 4 7 1 7 7 1 4 1 7 1 4 7 1 4 7 7 4 1 1 7 4 7 1 7 1 7 1 1 7 1 7 4 7 7 1 7 4 1 7 1 4 7 4 7 1 4 7 1 4 1 4 1 7 1 1 7 4 7 4 1 7 4 1 7 1 4 7 1 7 1 7 4...

output:

95820

result:

ok single line: '95820'

Test #126:

score: 0
Accepted
time: 39ms
memory: 11912kb

input:

1
200000
10 7 2 10 2 10 2 7 10 2 2 10 10 10 2 10 2 7 7 7 2 10 7 2 10 7 2 7 10 7 10 7 10 2 10 7 2 2 7 2 10 7 2 7 2 7 2 7 2 10 7 10 2 7 2 10 7 10 7 2 2 10 2 10 7 10 2 2 7 10 7 2 2 10 2 7 10 7 10 2 10 2 7 10 7 2 2 2 10 7 2 7 2 10 2 7 10 7 2 10 2 10 7 2 7 10 7 2 10 7 10 2 2 10 2 10 2 10 2 10 2 7 2 7 10 ...

output:

87271

result:

ok single line: '87271'

Test #127:

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

input:

1
200000
1 6 1 6 1 6 10 1 10 1 10 1 1 6 1 10 6 10 1 6 1 10 6 1 6 10 6 10 10 1 10 10 6 1 10 1 6 10 6 10 6 10 6 10 6 10 1 10 6 10 6 1 10 6 10 6 10 6 6 10 6 10 1 1 6 10 1 10 6 10 6 1 10 1 6 10 6 1 6 1 10 1 10 6 1 10 1 6 10 6 1 6 6 10 6 1 1 6 1 6 10 1 6 1 10 1 1 6 1 10 1 1 10 6 10 10 6 10 1 10 1 10 6 10...

output:

95918

result:

ok single line: '95918'

Test #128:

score: 0
Accepted
time: 30ms
memory: 11972kb

input:

1
200000
10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 3 9 3 9 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 10 6 3 10 3 10 3 10 3 10 3 3 10 3 10 3 10 3 10 3 10 3 10 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 ...

output:

16019

result:

ok single line: '16019'

Test #129:

score: 0
Accepted
time: 34ms
memory: 12056kb

input:

1
200000
4 5 4 5 4 5 4 4 5 6 5 4 5 6 4 6 4 6 4 6 4 6 6 4 6 4 6 4 6 4 6 4 6 4 6 4 6 4 6 6 4 6 4 6 4 6 4 4 6 4 6 4 6 6 8 6 6 4 4 8 6 4 8 6 4 8 4 8 4 4 8 8 4 8 4 8 4 8 8 4 8 4 8 4 8 4 8 4 8 4 8 4 8 4 8 4 8 4 8 4 4 8 4 8 4 8 4 8 4 8 4 8 4 8 8 4 8 4 8 4 8 4 8 8 4 8 4 8 4 8 4 8 4 8 4 8 4 8 4 8 4 8 4 8 4 4...

output:

14313

result:

ok single line: '14313'

Test #130:

score: 0
Accepted
time: 26ms
memory: 12096kb

input:

1
200000
5 3 5 3 5 3 5 1 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 3 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 6 5 3 5 6 3 5 6 3 6 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 10 3 5 3 10 3 10 3 10 3 10 3 10 3 10 3 10 3 10 3 10 3 10 10 3 10 10 3 10 3 10 3 10 3 10 3 3 10 3 10 3 10 3 10 3 10 3 10 3 10 3 10 3 10 ...

output:

15513

result:

ok single line: '15513'

Test #131:

score: 0
Accepted
time: 38ms
memory: 11972kb

input:

1
200000
7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 10 3 10 9 10 3 10 9 10 3 10 9 10 3 10 9 10 3 ...

output:

149344

result:

ok single line: '149344'

Test #132:

score: 0
Accepted
time: 39ms
memory: 11968kb

input:

1
200000
8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 1...

output:

149377

result:

ok single line: '149377'

Test #133:

score: 0
Accepted
time: 39ms
memory: 12100kb

input:

1
200000
2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 3 9 3 1 3 9 3 1 3 9 3...

output:

149345

result:

ok single line: '149345'

Test #134:

score: 0
Accepted
time: 34ms
memory: 11968kb

input:

1
200000
8 2 8 2 8 2 8 2 8 2 8 2 8 2 8 2 2 8 2 8 2 8 2 8 2 8 2 8 8 2 2 8 2 8 2 10 2 10 2 10 2 10 2 10 4 10 4 10 3 2 3 2 3 2 3 2 3 2 3 8 3 8 3 8 3 8 3 8 3 8 3 8 3 8 3 8 3 8 3 8 3 8 3 8 3 8 3 8 3 8 3 8 3 8 6 8 6 8 1 8 1 8 8 1 8 1 8 1 8 1 8 1 8 1 8 1 8 1 8 1 8 7 8 7 8 7 8 10 8 10 8 10 10 8 10 8 8 10 8 ...

output:

25620

result:

ok single line: '25620'

Test #135:

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

input:

1
200000
6 5 6 6 1 6 1 6 10 4 10 6 10 6 10 6 10 6 10 6 10 6 10 6 10 6 10 6 1 6 7 6 7 6 7 6 7 6 7 6 7 6 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 7 6 7 6 7 6 7 6 7 6 7 6 9 10 9 10 9 10 9 10 9 10 9 10 9 10 10 9 10 9 10 9 10 3 10 3 10 3 10 3 10 4 10 4 10 4 10 4 9 4 9 4 9 4 9 7 9 7 9 7 9 7 9 7 9 7 9 7 9 7 9 7...

output:

25827

result:

ok single line: '25827'

Test #136:

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

input:

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

output:

25640

result:

ok single line: '25640'

Test #137:

score: 0
Accepted
time: 44ms
memory: 12124kb

input:

1
200000
5 6 4 6 4 4 5 6 5 6 5 4 5 6 6 5 4 6 4 5 4 5 5 4 5 4 6 4 6 4 6 5 4 6 4 6 5 6 4 5 6 4 5 6 5 6 5 4 5 4 6 4 5 5 5 4 5 4 5 4 5 4 6 4 6 5 6 5 5 4 6 5 6 5 5 6 5 8 4 6 8 4 6 4 4 8 4 6 8 6 4 8 4 6 6 8 6 8 4 8 4 8 4 6 4 6 8 4 8 4 8 6 6 8 6 8 6 4 8 8 6 8 8 4 6 4 8 4 6 8 4 8 4 8 6 4 8 6 8 6 4 6 4 8 4 4...

output:

54939

result:

ok single line: '54939'

Test #138:

score: 0
Accepted
time: 44ms
memory: 11924kb

input:

1
200000
4 3 4 3 4 3 4 3 4 3 4 4 3 4 4 3 9 3 9 3 9 3 9 3 9 3 10 9 3 10 3 9 3 10 3 9 3 10 3 10 3 10 3 10 3 10 3 10 3 10 3 10 3 3 10 3 10 3 10 3 10 3 10 3 10 10 3 3 8 3 10 3 8 3 10 3 8 10 10 8 10 8 10 8 10 8 10 8 10 8 10 8 10 8 10 8 10 8 10 8 10 8 10 8 10 8 10 8 10 8 10 8 8 10 8 10 8 10 8 10 8 10 8 10...

output:

50710

result:

ok single line: '50710'

Test #139:

score: 0
Accepted
time: 39ms
memory: 11948kb

input:

1
200000
6 10 2 10 2 10 6 2 2 10 10 2 10 6 2 6 2 10 6 2 6 10 6 10 6 2 6 2 6 10 2 6 10 6 2 10 2 2 10 2 10 6 10 6 2 10 6 2 6 10 6 2 10 6 6 2 6 10 10 6 10 10 6 10 6 2 10 2 6 2 10 2 10 6 10 2 10 6 10 6 2 6 10 2 10 2 6 10 2 6 2 10 2 10 2 6 10 2 6 10 6 10 4 10 4 4 2 10 4 10 4 10 2 10 4 2 2 10 4 10 2 4 10 ...

output:

51364

result:

ok single line: '51364'

Test #140:

score: 0
Accepted
time: 46ms
memory: 7140kb

input:

5
31438
7 5 5 3 5 3 3 7 5 1 7 4 4 4 4 2 2 7 3 3 1 2 2 7 2 4 7 3 4 6 7 1 1 4 3 4 4 3 3 3 1 4 3 1 3 7 3 6 1 4 4 7 4 6 6 6 7 4 6 4 1 1 2 7 6 2 3 4 3 4 2 2 3 4 6 3 2 2 1 3 6 2 4 4 7 2 5 5 3 5 3 5 6 5 5 4 5 5 4 2 5 5 7 2 5 6 2 6 6 6 6 6 2 7 7 5 1 1 5 3 6 5 7 6 1 4 3 5 4 4 6 7 7 4 7 1 6 7 6 2 2 3 4 1 6 1 ...

output:

22591
34465
68516
25897
380

result:

ok 5 lines

Test #141:

score: 0
Accepted
time: 41ms
memory: 6844kb

input:

5
80502
3 1 7 1 3 1 3 7 3 7 1 3 1 3 1 7 3 1 3 1 1 7 3 7 3 1 3 1 3 7 3 1 7 1 3 1 7 1 7 1 7 1 7 1 7 1 3 7 3 1 3 7 1 3 7 3 1 3 7 3 7 3 7 3 7 1 3 7 3 1 7 1 3 7 3 7 1 7 1 3 1 7 3 1 3 7 3 7 3 3 7 3 1 7 1 7 3 3 7 1 7 1 3 1 3 1 1 7 1 3 7 1 3 7 1 7 3 1 7 3 1 7 3 7 3 7 1 7 3 7 3 7 1 3 1 3 7 1 3 1 7 3 1 7 1 7 ...

output:

39267
6856
16735
26256
6758

result:

ok 5 lines

Test #142:

score: 0
Accepted
time: 41ms
memory: 6500kb

input:

5
39449
3 5 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 3 3 3 5 3 5 3 5 3 3 5 3 3 5 1 5 5 3 3 5 3 5 5 5 3 5 3 5 3 5 3 5 5 3 5 3 5 5 3 3 3 5 3 5 3 5 3 5 3 5 3 5 3 5 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 ...

output:

2639
3386
4659
334
2110

result:

ok 5 lines

Test #143:

score: 0
Accepted
time: 32ms
memory: 8812kb

input:

5
5953
1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 3 5 3 2 3 5 3 2 3 5 3 7 5 7 6 7 5 7 6 7 5 7 1 5 1 2 1 5 1 2 1 5 1 2 1 5 1 6 5 6 7 6 5 6 2 5 2 4 2 5 2 4 2 5 2 4 2 5 2 4 2 5 2 4 2 5 2 4 2 5 2 4 2 5 2 4 2 5 2 4 2 5 2 4 2 5 2 1 5 1 7 1 5 1 7 1 5 1 4 5 4 3 4 5 4 3 4 5 4 7 5 7 2 7 5 7...

output:

4159
17937
96620
8083
21726

result:

ok 5 lines

Test #144:

score: 0
Accepted
time: 35ms
memory: 6456kb

input:

5
26964
2 5 2 5 2 5 2 2 5 5 2 5 2 5 2 5 2 5 2 5 2 6 6 2 6 2 2 6 2 6 2 6 2 6 2 2 1 2 3 2 3 2 3 2 7 7 2 7 2 2 7 7 2 7 2 7 2 7 2 7 7 2 7 7 2 7 1 7 4 4 7 6 6 7 6 6 7 6 7 6 7 7 6 6 6 6 7 6 7 6 7 6 7 6 7 7 6 7 6 2 6 2 6 2 6 2 2 6 6 2 6 2 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 2 6 2 6 2 6 2 2 6 2 6 2 6 2 6 6 2 6 2 ...

output:

3054
7918
8088
1992
2731

result:

ok 5 lines

Test #145:

score: 0
Accepted
time: 39ms
memory: 9416kb

input:

5
10441
5 6 5 6 5 6 5 6 5 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 4 6 4 6 4 6 4 6 4 6 4 6 4 6 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 7 7 7 6 7 6 7 6 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 4 7 4 7 4 7 ...

output:

2228
2939
7794
2791
17974

result:

ok 5 lines

Test #146:

score: 0
Accepted
time: 41ms
memory: 6300kb

input:

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

output:

51801
44778
7029
3998
50014

result:

ok 5 lines

Test #147:

score: 0
Accepted
time: 38ms
memory: 10432kb

input:

5
165460
6 7 4 7 4 7 4 7 7 6 7 7 4 7 6 7 4 7 7 4 6 6 4 6 7 6 4 6 4 6 7 6 4 7 6 4 7 4 6 7 4 6 6 4 7 6 7 4 7 6 4 6 7 4 7 4 6 6 4 4 6 7 7 4 6 4 7 4 4 4 7 4 7 4 4 6 7 4 7 4 4 7 7 6 4 7 6 7 4 8 6 8 4 6 6 8 8 8 4 8 4 4 6 4 6 4 8 4 8 6 4 8 6 4 6 8 4 6 8 6 4 6 8 4 8 4 6 8 6 8 4 8 6 4 6 8 4 6 4 6 4 6 4 4 6 4...

output:

71565
12332
1267
1638
987

result:

ok 5 lines

Test #148:

score: 0
Accepted
time: 26ms
memory: 5764kb

input:

5
21146
9 3 9 9 9 3 8 3 3 9 3 8 3 9 3 3 3 9 3 9 3 9 3 9 5 3 9 5 9 3 9 5 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 5 9 5 9 5 9 5 9 5 5 9 5 9 5 9 5 9 5 5 9 5 9 9 9 5 9 5 9 9 5 9 5 5 9 5 9 5 9 5 9 5 9 9 5 9 5 9 9 5 9 5 9 5 9 5 9 9 5 9 5 9 5 5 9 5 9 5 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 5 9 5 9 5 ...

output:

1582
4002
3180
2214
3804

result:

ok 5 lines

Test #149:

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

input:

5
27833
8 3 8 7 8 3 8 7 8 3 8 7 8 3 8 7 8 3 8 7 8 3 8 7 8 3 8 7 8 3 8 7 8 3 8 7 8 3 8 7 8 3 8 7 8 3 8 7 8 3 8 10 3 10 1 10 3 10 1 10 3 10 1 10 3 10 1 10 3 10 1 10 3 10 1 10 3 10 1 10 3 10 6 3 6 7 6 3 6 1 3 1 10 1 3 1 10 1 3 1 10 1 3 1 10 1 3 1 10 1 3 1 10 1 3 1 7 3 7 6 7 3 7 6 7 3 7 6 7 3 7 6 7 3 7 ...

output:

20420
5045
74592
21902
26524

result:

ok 5 lines

Test #150:

score: 0
Accepted
time: 31ms
memory: 6360kb

input:

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

output:

7432
3252
8288
5140
448

result:

ok 5 lines

Test #151:

score: 0
Accepted
time: 35ms
memory: 7044kb

input:

5
17501
3 1 3 7 3 1 3 7 1 7 1 3 7 3 7 3 7 1 1 7 1 3 1 3 1 7 1 7 3 1 3 7 3 7 1 7 3 7 1 3 1 7 1 3 7 3 7 1 3 7 3 7 3 1 3 1 3 7 1 7 1 7 3 7 3 1 3 7 3 7 1 3 7 3 1 3 7 3 7 1 7 1 7 1 7 3 1 7 3 1 7 1 7 1 3 7 7 3 1 3 7 1 7 1 3 1 3 3 7 1 3 7 1 7 3 1 3 1 7 3 7 1 3 1 7 3 7 3 7 1 7 7 3 7 3 7 3 1 7 3 7 1 3 7 1 3 ...

output:

9594
22507
2017
9617
53924

result:

ok 5 lines

Test #152:

score: 0
Accepted
time: 41ms
memory: 5152kb

input:

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

output:

15570
5273
1147
2125
9270
22092
29594
32800
7667
35158

result:

ok 10 lines

Test #153:

score: 0
Accepted
time: 42ms
memory: 6744kb

input:

10
1409
5 7 5 7 5 7 5 7 4 4 5 4 5 7 4 5 5 7 5 5 7 4 7 5 7 5 4 7 4 4 5 7 4 5 4 5 4 5 4 5 4 5 7 5 4 7 7 5 7 5 7 5 4 5 7 5 7 5 4 5 4 7 4 7 5 4 5 4 7 5 4 7 5 4 4 7 5 4 5 4 5 4 7 5 4 5 7 5 7 7 5 4 7 4 4 7 5 4 4 7 4 7 5 7 4 7 5 7 4 5 7 4 7 5 4 5 4 7 4 7 5 7 4 7 5 7 5 7 4 7 5 4 5 4 5 4 5 7 4 5 4 5 7 4 5 7 ...

output:

650
35953
5072
9541
12804
3615
2850
2157
6906
13231

result:

ok 10 lines

Test #154:

score: 0
Accepted
time: 39ms
memory: 5632kb

input:

10
3068
5 9 5 9 5 9 5 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 9 7 5 3 7 3 5 3 3 7 3 7 3 7 3 7 3 7 3 7 7 3 7 3 7 3 7 3 7 3 7 3 7 3 7 3 3 7 3 7 3 7 7 3 7 3 7 3 7 3 7 3 10 7 10 7 10 7 10 7 10 7 10 7 10 7 10 7 10 7 10 7 10 5 10 5 10 5 10 5 10 5 10 5 10 5 10 5 5 10 5 10 5 10 5 10 5 10 5 10 5 10 5 10 5 ...

output:

204
2149
1155
1115
991
3692
1579
2168
678
1240

result:

ok 10 lines

Test #155:

score: 0
Accepted
time: 32ms
memory: 5732kb

input:

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

output:

1282
2046
23379
6663
35969
40360
8461
620
3104
24727

result:

ok 10 lines

Test #156:

score: 0
Accepted
time: 41ms
memory: 6144kb

input:

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

output:

4227
1111
981
2894
1608
4548
8530
144
851
759

result:

ok 10 lines

Test #157:

score: 0
Accepted
time: 34ms
memory: 5108kb

input:

10
19664
8 3 8 3 8 3 8 3 8 3 6 3 6 3 6 3 6 3 6 3 6 10 6 10 6 10 10 6 10 6 1 2 10 2 10 1 6 1 1 6 1 6 1 4 4 1 4 1 4 1 4 1 4 1 1 4 2 4 2 4 2 4 2 4 2 4 2 4 3 4 3 4 3 4 4 3 4 3 4 3 4 3 4 4 3 4 3 8 3 8 3 8 3 3 8 8 3 8 3 8 3 8 3 8 3 8 8 3 8 3 8 3 8 3 8 3 8 3 8 8 3 8 3 8 8 3 10 3 10 10 3 10 3 10 3 10 3 10 3...

output:

7234
1736
6467
9165
5296
3407
1844
9426
2596
7120

result:

ok 10 lines

Test #158:

score: 0
Accepted
time: 39ms
memory: 4404kb

input:

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

output:

3618
1638
4366
1145
5820
3172
3021
558
4339
396
2287
10199
3959
38
7014
4576
2299
19022
1055
7055
7479
1830
1052
163
5597
722
8599
4688
1579
2200
917
5032
11201
6255
11268
1614
3637
1408
3632
1630

result:

ok 40 lines

Test #159:

score: 0
Accepted
time: 42ms
memory: 4108kb

input:

40
2659
3 4 2 4 3 2 3 4 3 2 4 3 2 3 4 4 4 3 2 4 2 3 2 4 3 2 3 2 3 2 4 2 3 4 3 4 2 4 2 3 2 3 4 2 4 2 4 3 2 3 2 4 2 4 3 2 4 4 2 4 3 2 3 2 3 4 3 2 3 4 3 2 3 2 4 3 4 3 2 3 4 2 4 3 2 4 3 4 3 2 4 3 4 2 3 4 3 4 4 3 4 3 2 4 2 3 2 3 4 2 3 4 2 3 4 2 3 4 2 3 2 3 2 4 3 4 3 4 2 2 2 4 2 3 2 4 4 2 4 2 4 2 3 2 4 3 ...

output:

1299
3684
2696
1494
153
400
2888
1651
4821
1622
3710
2502
377
2776
4960
457
1825
789
3808
1993
799
454
209
2305
1958
3720
8738
4637
2076
1025
2831
2262
5457
2709
3114
2917
1749
1823
1335
158

result:

ok 40 lines

Test #160:

score: 0
Accepted
time: 33ms
memory: 4076kb

input:

40
5834
8 9 8 9 8 9 8 9 8 9 8 9 8 9 8 9 8 9 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 8 1 6 1 8 1 8 1 8 1 8 1 8 1 8 1 8 1 8 8 1 8 1 8 1 8 1 8 1 1 8 7 8 7 8 7 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 8 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 ...

output:

434
106
610
887
283
258
55
456
285
983
110
427
119
241
496
93
1178
702
31
102
24
168
222
305
556
779
423
469
24
10
339
302
266
230
114
850
1263
15
179
282

result:

ok 40 lines

Test #161:

score: 0
Accepted
time: 27ms
memory: 4620kb

input:

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

output:

13161
538
5394
20556
822
3427
5646
4931
6727
794
3928
370
5593
12003
2195
1924
62
440
245
9001
84
2626
2679
147
2330
6373
482
1514
1161
877
2247
10013
2381
1737
1489
4311
251
1927
610
1601

result:

ok 40 lines

Test #162:

score: 0
Accepted
time: 37ms
memory: 4240kb

input:

40
3170
6 1 7 1 7 1 7 1 7 1 7 1 7 1 7 1 7 1 7 1 7 1 7 1 7 1 7 1 7 1 7 1 7 7 1 4 1 4 1 4 3 4 3 4 3 4 3 4 3 4 3 4 3 3 4 3 4 3 4 3 4 3 4 4 3 4 3 4 3 4 3 4 3 4 4 3 4 3 4 3 10 10 3 10 3 6 6 3 6 3 6 3 6 7 6 7 6 7 6 5 7 5 7 5 7 5 7 5 7 5 7 5 7 5 7 5 7 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 9 2 9 2...

output:

450
402
1042
824
242
747
659
874
174
890
834
502
38
916
538
754
96
823
161
116
748
712
707
2174
1107
1914
600
504
988
285
887
945
868
18
493
242
641
100
145
283

result:

ok 40 lines

Test #163:

score: 0
Accepted
time: 35ms
memory: 4692kb

input:

40
2690
1 9 9 8 10 9 8 9 8 9 10 8 1 9 1 9 1 9 1 10 9 1 9 10 1 10 9 10 9 10 9 10 1 9 10 9 1 9 10 9 1 9 10 9 6 1 6 9 1 9 6 9 1 6 1 6 1 6 1 6 9 1 6 9 1 6 1 9 1 6 1 9 1 6 9 1 6 9 6 1 6 1 1 6 9 6 9 6 9 6 1 6 9 6 1 6 9 6 9 1 9 6 1 6 7 4 3 4 3 7 3 4 4 7 3 7 4 6 10 6 10 6 10 6 10 6 10 6 6 10 6 10 6 10 6 10 ...

output:

923
1464
95
322
671
239
3698
18558
762
9990
2549
423
916
1475
315
373
12
885
73
720
3876
5412
520
1052
288
2425
2074
2425
144
5855
672
3722
2242
1376
784
3824
494
1019
244
4872

result:

ok 40 lines

Test #164:

score: 0
Accepted
time: 48ms
memory: 3508kb

input:

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

output:

643
289
134
1604
167
111
466
676
2108
795
146
313
232
7
191
192
473
228
2
74
99
1514
489
6
161
654
631
20
539
380
89
201
370
24
469
267
1287
401
834
473
558
495
463
330
193
29
114
248
669
358
637
1113
15
2852
1159
179
90
168
74
761
120
312
810
15
1568
63
417
73
688
232
280
75
29
1917
496
33
113
163
...

result:

ok 400 lines

Test #165:

score: 0
Accepted
time: 41ms
memory: 3488kb

input:

400
523
1 3 6 1 6 3 1 1 6 3 6 3 1 3 1 3 8 3 1 8 1 3 8 1 3 8 1 3 8 3 8 4 8 3 6 8 6 6 3 8 6 8 3 6 8 8 6 8 3 2 6 2 6 6 3 6 3 2 3 2 3 6 2 6 2 6 3 2 3 2 6 4 3 4 6 4 4 3 4 6 4 3 6 6 3 6 4 3 6 4 3 4 3 6 4 3 4 6 3 4 6 3 4 3 3 6 8 3 8 4 3 4 3 4 10 3 4 3 10 10 4 4 10 4 10 6 10 3 6 3 10 6 3 10 3 10 3 10 6 10 6...

output:

255
9
390
100
25
233
183
264
43
523
430
90
61
56
176
16
727
117
312
81
142
14
19
173
60
172
6
430
169
623
44
107
222
1
238
694
73
82
246
586
42
436
544
11
155
121
140
706
94
122
421
8
245
161
441
169
167
461
200
416
728
192
18
95
16
158
450
477
78
327
37
782
465
252
394
1034
55
227
343
128
555
901
4...

result:

ok 400 lines

Test #166:

score: 0
Accepted
time: 35ms
memory: 3512kb

input:

400
5
8 1 8 1 8
374
5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 1 1 5 1 5 1 1 5 5 1 5 5 5 1 5 1 5 1 1 5 5 1 5 1 1 5 1 5 5 1 1 5 1 5 1 5 1 5 1 5 5 1 5 1 5 1 5 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 5 1 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 1 1 5 1 5 1 5 1 5 1 5 1 5 1 ...

output:

2
22
80
11
4
24
84
65
80
70
26
143
80
149
74
79
29
4
2
23
22
76
57
19
84
19
12
87
31
8
62
2
15
101
25
99
18
9
16
20
31
9
10
12
2
48
19
36
68
8
53
12
4
66
57
30
41
4
22
27
10
40
113
59
9
19
31
2
19
93
13
6
11
28
54
67
10
105
6
7
28
28
4
91
142
12
49
11
24
2
4
2
32
2
4
21
2
51
6
7
7
37
53
4
36
24
10
8...

result:

ok 400 lines

Test #167:

score: 0
Accepted
time: 41ms
memory: 3692kb

input:

400
709
1 4 1 2 1 4 1 2 1 4 1 2 1 4 1 2 1 4 1 2 1 4 1 2 1 4 1 2 1 4 1 2 1 4 1 2 1 4 1 2 1 4 1 2 1 4 1 5 4 5 8 5 4 5 8 5 4 5 8 5 4 5 8 5 4 5 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 6 4 6 1 6 ...

output:

516
572
72
375
376
83
167
383
97
622
11
148
1178
957
538
81
9
49
386
677
364
735
225
320
807
233
34
216
1991
135
702
17
7
76
12
531
656
1024
662
474
98
674
62
100
296
618
123
1438
307
622
214
529
135
684
101
1100
84
378
42
275
61
1417
138
716
1166
388
72
45
479
604
335
2
965
142
89
216
72
480
821
63...

result:

ok 400 lines

Test #168:

score: 0
Accepted
time: 41ms
memory: 3532kb

input:

400
699
8 2 8 2 8 2 8 2 8 2 8 2 8 2 8 2 8 2 8 2 4 2 4 2 4 2 4 2 9 2 9 10 9 10 9 10 5 10 5 10 5 10 5 10 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 8 1 8 1 8 1 8 1 8 1 8 1 8 1 8 1 8 1 8 6 8 6 9 6 9 6 9 6 9 4 9 4 9 4 9 4 9 4 9 4 9 4 9 4 9 4 9 4 9 4 9 4 3 4 3 4 3 3 4 9 4 9 4 9 4 8 4 8 4...

output:

90
225
83
19
24
69
33
159
62
41
43
23
59
52
8
16
17
62
35
231
88
14
42
54
40
86
25
93
158
24
21
34
33
57
20
42
241
206
60
17
87
3
205
28
33
113
70
25
13
58
4
31
165
52
56
7
20
34
27
26
94
41
32
52
22
69
33
11
122
21
7
20
4
124
6
85
39
47
38
1
61
66
34
122
219
34
47
9
48
60
29
24
68
45
49
30
32
11
63...

result:

ok 400 lines

Test #169:

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

input:

400
801
10 3 10 3 10 3 10 10 3 3 10 3 10 3 10 3 10 3 10 7 6 7 6 7 6 6 7 6 7 6 7 6 7 7 4 6 7 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 6 7 6 7 6 7 6 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 1 7 4 6 1 7 1 6 7 6 1 7 6 1 6 7 7 6 6 6 7 6 7 6 7 6 7 6 4 6 4 4 6 4 6 4 6 4 4 6 6 4 6 4 3 9 4 9 4 9 4 9 4 9 4 9 4 9 4 9 4 9 4 9 ...

output:

118
413
269
126
612
16
243
73
57
221
165
223
201
16
35
77
758
46
198
52
89
188
8
9
51
89
14
30
152
103
4
6
230
263
47
251
241
159
60
22
47
18
25
203
83
73
116
16
306
357
71
338
149
38
49
33
598
95
36
376
290
990
307
56
29
58
174
69
56
251
62
94
12
209
103
129
199
220
7
497
77
220
152
44
24
21
33
379...

result:

ok 400 lines

Test #170:

score: 0
Accepted
time: 80ms
memory: 3488kb

input:

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

output:

5
64
117
18
34
56
16
44
28
31
38
16
49
31
71
16
17
57
87
9
5
6
148
26
9
17
24
70
6
1
6
88
29
3
82
76
30
91
24
44
29
14
22
14
13
11
5
15
14
23
2
31
17
12
29
12
111
18
19
19
18
12
32
25
7
19
12
68
32
14
10
10
28
9
54
23
14
22
25
10
11
15
36
25
41
6
25
50
25
8
23
39
34
30
20
9
9
39
46
22
3
8
15
8
7
17
...

result:

ok 5000 lines

Test #171:

score: 0
Accepted
time: 61ms
memory: 3280kb

input:

5000
77
4 3 4 2 3 4 2 3 2 10 10 3 2 3 3 10 2 10 2 10 2 10 3 10 2 3 2 10 3 2 10 2 3 10 7 2 10 2 7 2 10 2 7 2 10 2 7 10 2 10 7 1 10 1 10 1 1 7 1 7 10 1 10 1 10 7 1 7 1 7 8 1 2 1 5 2 1
6
2 3 5 5 2 3
15
1 4 4 1 4 9 4 9 4 9 4 9 9 4 9
29
1 8 3 3 8 8 9 3 9 8 3 8 9 9 3 9 3 9 8 3 8 9 3 9 3 9 8 8 9
89
10 7 2 ...

output:

46
5
4
13
60
73
1
24
16
18
29
28
22
7
60
14
8
6
68
58
8
25
42
42
7
63
65
3
5
27
24
77
40
59
13
33
40
1
3
30
8
28
41
30
30
16
49
7
50
15
18
31
11
18
6
8
13
8
3
21
22
19
13
5
11
8
11
6
6
33
37
20
1
10
5
19
36
52
13
14
40
27
11
26
6
73
25
5
1
15
13
2
13
23
14
25
11
2
5
11
9
2
41
10
41
3
35
41
6
10
9
18...

result:

ok 5000 lines

Test #172:

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

input:

5000
9
5 8 5 8 5 8 5 8 5
9
7 2 7 2 7 2 7 2 7
81
6 7 6 7 6 7 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7
76
3 5 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 5 3 5 3 5 3 5 5 3 5 3 5 3 5 3...

output:

2
2
2
2
2
2
8
2
2
2
7
11
2
2
2
10
2
4
2
9
9
18
6
1
2
5
5
7
6
2
2
2
2
2
9
2
2
2
14
2
2
25
1
19
10
13
11
11
2
2
23
2
1
2
2
4
6
2
1
1
20
2
14
2
2
2
14
7
2
2
7
2
2
2
2
2
7
2
2
16
14
2
6
2
9
2
21
4
2
5
2
2
5
4
6
2
1
13
2
2
24
9
2
2
13
2
2
6
2
4
2
1
10
5
2
2
5
5
2
11
2
2
2
2
1
2
6
12
4
13
5
8
2
2
12
10
2
...

result:

ok 5000 lines

Test #173:

score: 0
Accepted
time: 55ms
memory: 3288kb

input:

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

output:

78
16
25
6
3
19
48
15
7
13
28
7
5
36
48
8
10
85
49
44
2
3
16
21
25
65
26
91
23
2
81
34
17
28
19
16
15
4
15
79
6
18
5
27
44
10
30
35
54
13
26
35
143
19
27
27
2
22
11
31
32
63
4
14
55
59
28
16
31
7
43
46
34
2
45
41
10
53
18
64
11
50
49
14
52
28
50
2
36
8
42
12
39
8
25
1
176
6
9
47
48
17
5
21
35
5
23
1...

result:

ok 5000 lines

Test #174:

score: 0
Accepted
time: 82ms
memory: 3376kb

input:

5000
8
8 5 8 2 3 2 3 2
11
4 9 4 9 4 9 4 9 4 6 4
68
6 1 6 1 6 1 6 1 6 1 6 2 6 2 6 2 6 6 6 2 6 2 6 2 6 5 6 5 5 6 5 6 5 6 5 6 5 6 6 5 6 5 6 5 6 2 6 2 6 2 6 6 2 6 6 2 6 2 6 2 6 2 6 2 6 2 1 2
42
9 10 9 10 9 10 9 10 9 5 9 5 9 5 9 5 5 5 5 9 5 9 5 9 5 9 5 9 5 9 5 4 5 4 5 4 5 5 4 5 4 4
8
6 10 6 10 1 10 1 10
...

output:

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

result:

ok 5000 lines

Test #175:

score: 0
Accepted
time: 72ms
memory: 3392kb

input:

5000
1
6
68
5 9 9 5 9 5 9 5 5 7 1 7 1 7 6 1 6 7 6 7 6 2 7 6 2 7 10 2 7 2 4 2 4 2 5 4 5 1 9 1 9 1 9 1 9 1 9 1 7 2 2 1 2 7 2 1 1 7 9 7 5 6 7 5 6 10 3 10
3
7 1 7
1
9
18
3 2 7 1 4 7 9 7 4 7 4 7 4 7 4 7 4 7
18
2 10 2 4 9 10 9 10 9 1 6 1 6 1 5 6 5 5
96
10 6 10 1 10 4 2 4 2 4 2 4 2 4 2 3 1 7 3 6 10 6 10 6 ...

output:

1
37
2
1
9
9
39
27
31
9
9
42
11
13
14
22
10
22
4
39
20
26
26
33
38
15
3
7
12
10
30
18
24
13
1
13
2
1
12
16
7
2
6
13
11
40
14
7
15
17
6
4
2
18
82
7
5
8
29
14
7
15
1
76
2
1
8
52
9
62
26
13
51
10
14
32
35
16
11
47
18
6
19
13
6
39
19
5
22
12
3
9
9
11
60
9
17
10
6
7
31
33
7
60
4
42
7
8
6
8
15
6
9
13
4
10...

result:

ok 5000 lines

Test #176:

score: 0
Accepted
time: 155ms
memory: 3520kb

input:

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

output:

2
9
2
2
3
3
1
2
4
6
6
1
3
2
1
7
6
1
7
4
4
2
6
9
1
4
1
3
4
2
4
1
5
6
1
1
3
10
2
23
3
3
4
10
1
9
1
4
4
4
4
4
1
13
2
1
11
1
3
2
4
5
1
3
7
2
5
7
3
1
3
1
6
1
7
1
2
2
2
7
4
8
4
2
3
1
4
12
3
3
1
1
1
4
8
1
20
15
3
1
20
1
2
4
2
4
3
1
2
10
10
5
10
1
1
5
3
8
5
8
1
5
1
8
5
5
11
3
2
4
1
2
8
9
2
3
4
4
3
1
4
4
5
3...

result:

ok 40000 lines

Test #177:

score: 0
Accepted
time: 131ms
memory: 3364kb

input:

40000
1
6
6
7 9 7 5 9 5
11
10 3 10 7 10 7 7 8 5 8 10
2
7 5
2
9 10
3
8 2 1
10
10 6 10 6 10 3 6 8 6 9
1
2
2
7 9
5
5 8 2 5 2
11
10 1 10 9 1 9 4 5 9 4 5
3
7 2 7
12
6 10 6 10 8 6 8 10 6 8 10 6
26
1 10 1 9 9 10 1 9 10 2 1 9 1 9 2 1 2 2 2 1 2 9 2 9 2 2
4
8 2 3 9
3
7 9 1
2
5 8
3
5 7 5
17
8 10 8 10 6 8 10 6 ...

output:

1
4
7
2
2
3
6
1
2
4
9
2
8
14
4
3
2
2
11
2
1
1
4
1
2
1
3
8
1
2
1
3
3
3
4
6
3
1
17
3
1
2
3
2
3
2
2
1
4
2
2
1
3
1
2
3
7
3
1
3
5
8
3
2
9
1
4
2
3
2
2
4
5
2
1
13
2
4
3
2
1
4
3
4
2
3
1
2
2
2
1
6
1
1
1
9
1
7
9
10
9
4
5
3
2
2
6
5
5
1
3
1
2
3
1
1
3
1
7
1
1
6
5
1
1
7
2
1
7
6
2
2
10
1
5
5
1
3
2
1
2
1
1
2
2
10
1...

result:

ok 40000 lines

Test #178:

score: 0
Accepted
time: 133ms
memory: 3392kb

input:

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

output:

2
2
1
2
2
1
2
1
1
2
1
2
2
2
2
2
4
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
1
2
2
3
3
2
2
1
2
2
1
2
2
2
2
2
2
2
1
2
2
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
6
2
1
2
2
1
1
2
1
2
1
2
2
2
2
2
2
1
2
2
2
1
2
2
2
1
2
1
2
1
2
2
2
2
1
2
2
1
2
2
1
2
2
1
2
2
2
1
2
2
2
2
2
1
2
1
2
2
2
2
2
2
2
2
1
1
2
2
2
2
1
1
2
2
2
...

result:

ok 40000 lines

Test #179:

score: 0
Accepted
time: 177ms
memory: 3360kb

input:

40000
18
5 4 3 8 1 5 8 8 5 2 8 4 5 7 1 3 5 3
2
4 10
4
5 7 5 10
5
1 5 6 3 2
1
4
7
8 1 1 3 4 3 4
2
4 3
7
7 1 9 2 4 8 3
2
5 8
18
2 10 9 8 2 5 4 8 10 5 3 1 8 4 10 6 5 2
3
8 6 9
5
7 5 8 2 9
2
9 3
1
3
4
2 7 1 6
16
5 2 4 1 7 2 6 8 9 3 10 8 10 3 2 6
1
4
11
7 4 9 9 7 2 4 5 9 3 4
2
3 8
6
5 10 6 5 4 10
7
1 8 2...

output:

14
2
3
5
1
4
2
7
2
18
3
5
2
1
4
15
1
10
2
6
6
1
2
3
4
1
1
8
1
1
4
7
2
3
2
14
3
1
1
5
15
3
1
6
2
2
1
5
3
4
2
3
5
1
1
11
5
5
7
2
6
1
1
8
2
10
6
2
1
6
4
2
4
5
2
5
1
3
1
3
7
2
4
10
14
2
2
3
7
5
9
2
5
5
2
2
3
1
5
11
1
2
4
2
7
6
1
3
2
1
4
3
4
2
7
3
5
6
7
3
5
3
1
4
3
1
3
9
1
1
2
2
2
1
3
4
2
1
4
18
1
3
5
1
...

result:

ok 40000 lines

Test #180:

score: 0
Accepted
time: 128ms
memory: 3544kb

input:

40000
6
6 3 6 3 6 3
1
1
2
1 5
3
1 6 1
2
3 4
2
2 3
2
4 5
2
1 8
1
6
5
1 8 1 8 1
13
2 10 2 10 2 10 10 2 10 2 10 2 10
2
7 3
6
7 6 7 1 7 1
3
8 7 8
3
10 9 10
1
9
8
9 4 9 4 9 4 9 9
4
10 5 10 5
5
6 4 6 4 6
15
4 10 4 10 4 4 10 4 10 4 4 10 4 10 4
10
7 1 7 1 7 1 7 1 7 7
6
3 8 3 8 3 3
10
4 4 3 4 10 4 10 4 10 4
...

output:

2
1
2
2
2
2
2
2
1
2
2
2
4
2
2
1
2
2
2
2
2
2
4
2
1
3
1
2
4
4
2
1
2
4
3
2
1
3
2
2
3
5
2
2
2
1
2
4
6
2
2
1
2
2
2
2
1
1
4
4
4
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
3
2
2
2
4
3
4
2
2
2
1
2
1
1
1
1
3
3
2
2
2
2
4
2
1
2
2
1
2
2
1
4
2
2
2
1
1
1
2
1
2
2
2
2
1
2
6
2
2
2
5
2
1
4
2
1
7
2
1
1
3
1
1
5
1
1
3
4
4
1
2
1
2
1
...

result:

ok 40000 lines

Test #181:

score: 0
Accepted
time: 101ms
memory: 3472kb

input:

40000
1
9
1
5
1
9
12
6 9 10 4 5 7 8 1 5 3 5 5
1
7
1
3
2
6 10
3
2 3 6
10
8 10 1 10 10 4 3 10 6 10
1
3
8
10 6 4 3 6 6 10 7
22
1 1 5 9 9 1 9 1 5 5 1 5 9 5 1 9 5 1 7 6 10 1
4
8 1 8 7
4
5 6 5 6
7
7 1 7 1 8 10 7
1
8
2
5 9
2
8 3
9
3 5 3 5 5 3 5 3 5
5
10 6 6 5 3
1
8
2
6 4
12
10 4 9 7 8 8 7 8 7 8 7 8
9
9 6 3...

output:

1
1
1
10
1
1
2
3
7
1
7
15
3
2
5
1
2
2
2
4
1
2
5
8
7
2
4
2
2
2
1
1
5
1
3
2
3
1
2
3
1
9
4
5
3
2
1
3
8
9
1
3
2
10
2
4
2
4
2
1
1
4
3
5
18
2
4
1
2
5
3
2
4
1
7
1
5
6
6
3
1
3
1
1
10
6
2
1
2
2
2
18
3
1
2
1
6
12
1
3
14
2
8
6
3
2
3
1
2
2
2
3
3
4
2
2
4
3
5
3
4
5
1
1
8
3
1
11
1
2
2
2
9
2
3
7
2
4
4
4
8
5
3
9
3
1...

result:

ok 40000 lines

Test #182:

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

input:

3
2397
5 1 7 7 5 5 5 2 6 1 6 2 5 2 2 7 7 2 1 3 5 7 5 3 4 2 5 2 5 6 5 1 7 5 3 7 2 6 7 3 3 1 2 3 4 7 2 7 3 6 6 6 5 2 6 7 4 7 5 3 6 5 7 6 2 1 1 1 4 1 6 7 3 4 1 7 7 2 7 7 2 6 1 1 7 6 6 2 1 3 2 3 3 4 1 6 7 2 3 2 2 2 5 3 1 7 4 5 7 4 2 3 4 7 3 3 5 7 3 6 7 3 4 7 4 6 1 6 2 6 2 6 2 4 6 6 3 6 2 5 5 7 4 5 1 3 6...

output:

1754
2724
3230

result:

ok 3 lines

Test #183:

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

input:

3
174
7 7 7 7 3 6 7 6 3 6 6 3 6 3 7 3 7 3 7 6 3 6 7 6 7 6 6 7 7 6 3 6 7 3 6 7 3 7 3 3 6 7 6 7 3 7 6 3 7 7 3 7 6 7 6 6 3 3 6 7 3 7 6 7 6 3 7 3 6 7 3 3 6 7 3 7 6 3 7 7 3 6 3 6 7 6 7 6 7 7 3 6 6 3 7 3 6 3 3 7 6 3 7 3 6 7 6 7 6 7 3 6 3 5 3 5 6 5 6 3 6 3 6 5 5 5 6 3 5 3 3 6 5 3 6 3 6 3 5 6 6 3 6 3 6 3 5 ...

output:

83
62
4581

result:

ok 3 lines

Test #184:

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

input:

3
2001
7 5 7 5 7 5 7 7 5 7 5 7 5 5 7 5 7 5 7 5 7 5 7 5 7 5 7 5 7 5 7 5 7 5 7 7 5 5 7 5 7 5 7 5 5 7 5 7 7 5 7 7 5 7 5 7 5 5 7 5 7 5 7 7 5 7 5 7 5 7 5 7 5 7 5 5 5 7 5 7 5 7 5 5 7 5 7 5 7 5 7 7 5 7 5 5 7 7 5 7 5 7 5 7 7 5 7 5 7 7 5 7 7 5 7 5 7 7 7 5 7 5 7 5 5 7 5 5 7 5 7 5 5 7 5 7 7 5 7 5 7 5 7 7 7 5 7...

output:

138
291
136

result:

ok 3 lines

Test #185:

score: 0
Accepted
time: 1ms
memory: 3860kb

input:

3
664
7 2 7 3 7 2 7 6 2 6 4 6 2 6 4 6 2 6 4 6 2 6 4 6 2 6 3 2 3 5 3 2 3 5 3 2 3 5 3 2 3 4 2 4 7 4 2 4 5 2 5 6 5 2 5 1 2 1 7 1 2 1 7 1 2 1 4 2 4 6 4 2 4 7 2 7 1 7 2 7 4 2 4 6 4 2 4 7 2 7 5 7 2 7 4 2 4 6 4 2 4 6 4 2 4 6 4 2 4 6 4 2 4 7 2 7 3 7 2 7 6 2 6 1 6 2 6 7 2 7 5 7 2 7 4 2 4 3 4 2 4 1 2 1 7 1 2 ...

output:

445
1161
5526

result:

ok 3 lines

Test #186:

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

input:

3
2492
5 6 5 6 5 6 5 6 5 2 5 2 5 2 7 2 7 7 2 7 2 7 2 7 2 7 2 7 2 7 2 2 7 6 7 6 7 6 7 6 7 5 7 5 5 7 5 7 5 7 5 7 5 7 3 3 3 7 2 7 2 6 1 6 1 6 1 6 1 6 6 1 1 6 1 6 1 6 1 6 1 2 1 1 2 1 1 2 1 2 1 2 1 2 1 1 1 5 1 5 4 5 4 5 4 1 4 1 4 1 4 1 2 1 2 1 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 5 2 5 2 5 2 6 2 6 7 6 7 6 6 7...

output:

294
521
359

result:

ok 3 lines

Test #187:

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

input:

3
1415
7 2 7 2 2 7 3 7 3 3 7 3 7 3 7 4 2 4 3 4 2 4 3 4 2 4 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 3 2 3 4 3 2 3 4 3 2 3 4 3 2 3 4 3 2 3 4 3 2 3 4 3 2 3 5 2 5 1 5 2 5 1 5 2 5 1 5 2 5 1 5 2 5 1 5 2 5 1 5 2 5...

output:

625
1436
596

result:

ok 3 lines

Test #188:

score: 0
Accepted
time: 42ms
memory: 11052kb

input:

3
17898
1 5 6 1 4 5 1 6 6 1 7 5 5 6 1 7 6 3 5 5 4 7 5 4 1 1 3 7 3 4 3 7 4 7 4 7 5 1 7 1 4 5 2 5 6 1 1 6 5 4 5 6 7 4 6 3 6 4 3 5 1 7 4 2 4 3 6 1 7 4 4 6 6 7 1 4 5 2 7 1 4 6 5 2 4 6 4 3 6 5 2 1 5 3 5 2 7 1 7 1 2 7 4 5 6 3 3 7 1 3 5 1 7 6 5 3 1 3 2 4 4 2 7 7 2 4 7 2 7 1 3 3 4 1 6 3 4 3 1 3 4 4 4 6 4 5 ...

output:

13568
148675
2837

result:

ok 3 lines

Test #189:

score: 0
Accepted
time: 40ms
memory: 7160kb

input:

3
38910
1 6 1 4 1 6 1 4 1 6 1 4 1 6 6 4 6 1 6 4 6 1 4 6 1 6 4 1 6 6 1 4 1 4 6 4 1 4 6 1 4 6 1 4 1 4 6 1 4 6 4 1 6 6 1 4 1 6 4 6 1 6 1 4 1 4 6 6 4 6 1 6 1 4 1 4 1 6 4 1 6 1 4 4 1 4 1 4 6 1 6 1 4 6 1 6 1 4 1 4 1 6 1 4 1 4 6 1 4 1 6 1 6 1 6 4 4 1 6 4 1 4 6 1 1 4 6 4 6 4 1 6 6 1 4 6 6 4 6 4 1 4 1 6 1 1 ...

output:

16989
42639
32426

result:

ok 3 lines

Test #190:

score: 0
Accepted
time: 32ms
memory: 8808kb

input:

3
47211
7 2 7 2 7 2 7 2 7 2 7 2 7 2 7 2 7 2 7 2 7 2 7 2 7 2 7 2 7 2 7 2 7 3 7 3 7 3 7 5 7 5 7 5 7 5 7 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 4 5 3 5 3 5 3 5 3 5 3 5 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 5 3 5 3 5 3 ...

output:

3525
1703
8644

result:

ok 3 lines

Test #191:

score: 0
Accepted
time: 30ms
memory: 7292kb

input:

3
92161
4 7 4 3 4 7 4 3 4 7 4 1 7 1 2 1 7 1 2 1 7 1 2 1 7 1 2 1 7 1 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 ...

output:

68687
56160
24330

result:

ok 3 lines

Test #192:

score: 0
Accepted
time: 38ms
memory: 7796kb

input:

3
81167
1 6 6 1 3 1 3 1 1 3 1 3 1 3 1 3 1 5 5 1 5 3 5 3 5 3 5 3 5 3 5 5 3 5 5 3 3 3 5 3 5 3 5 3 5 5 3 5 5 3 5 3 5 3 5 3 4 4 3 4 3 4 3 4 3 4 3 4 3 4 3 1 1 3 1 1 1 3 1 3 1 3 1 3 3 1 1 3 1 3 1 1 3 1 3 1 3 1 3 1 3 1 5 5 6 5 6 5 6 1 6 1 6 1 6 1 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 7 1 7 7 1 7 2 7 2 5 5 ...

output:

9129
1840
11031

result:

ok 3 lines

Test #193:

score: 0
Accepted
time: 26ms
memory: 7936kb

input:

3
7124
3 6 5 6 5 2 5 5 2 5 2 5 2 5 5 2 5 2 5 2 5 4 2 2 6 2 3 2 3 2 3 2 3 2 3 3 2 2 2 3 2 3 2 2 3 2 6 2 2 6 6 2 6 3 6 6 3 6 3 6 3 6 3 6 2 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 6 2 6 2 6 2 6 2 6 2 3 2 3 2 4 2 4 2 4 2 4 2 4 2 4 5 4 5 4 5 4 5 4 5 4 3 4 4 3 4 4 3 4 3 6 6 3 3 6 3 3 6 3 6 3 3 6 3 4 3 4 3 4 3 7 7...

output:

3675
19486
16811

result:

ok 3 lines

Subtask #6:

score: 20
Accepted

Dependency #3:

100%
Accepted

Test #194:

score: 20
Accepted
time: 2ms
memory: 3716kb

input:

3
2446
75658187 571962292 710943961 75658187 571962292 710943961 75658187 571962292 710943961 75658187 571962292 710943961 75658187 571962292 710943961 75658187 75658187 571962292 710943961 75658187 571962292 710943961 75658187 571962292 710943961 75658187 571962292 710943961 75658187 571962292 7109...

output:

1976
2886
3692

result:

ok 3 lines

Test #195:

score: 0
Accepted
time: 2ms
memory: 3664kb

input:

3
3362
868620636 31980970 377172121 868620636 825296563 377172121 868620636 825296563 825296563 377172121 868620636 825296563 377172121 868620636 825296563 825296563 377172121 868620636 825296563 825296563 377172121 868620636 825296563 377172121 868620636 868620636 825296563 377172121 377172121 8686...

output:

2927
713
4211

result:

ok 3 lines

Test #196:

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

input:

3
6100
984136452 630128462 871470770 984136452 630128462 871470770 871470770 984136452 630128462 630128462 871470770 984136452 630128462 871470770 984136452 630128462 871470770 984136452 630128462 871470770 984136452 630128462 871470770 984136452 630128462 871470770 984136452 630128462 871470770 984...

output:

5703
1225
1688

result:

ok 3 lines

Test #197:

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

input:

20
420
839 222 822 839 222 822 839 222 822 822 822 839 222 822 839 222 822 839 222 822 839 222 822 839 222 822 839 222 822 839 222 822 839 222 822 839 222 822 839 222 822 839 222 822 839 222 822 839 222 822 839 222 822 839 222 822 839 222 822 839 222 822 839 222 822 839 222 822 839 222 822 839 222 8...

output:

382
315
240
642
198
495
384
26
237
1165
984
455
216
145
19
349
246
851
1
946

result:

ok 20 lines

Test #198:

score: 0
Accepted
time: 2ms
memory: 3440kb

input:

100
288
54841 69122 34721 54841 69122 69122 34721 69122 56469 34721 69122 54841 34721 69122 54841 34721 69122 69122 54841 34721 69122 69122 69122 54841 34721 69122 54841 34721 69122 54841 34721 69122 54841 34721 69122 54841 34721 34721 69122 54841 34721 69122 54841 34721 69122 69122 54841 54841 3472...

output:

248
80
7
14
41
28
151
13
171
53
40
10
22
3
50
192
84
152
42
53
103
12
29
28
42
168
159
129
46
40
63
156
16
172
68
262
18
56
3
20
16
9
13
25
66
8
182
77
139
34
1
371
94
31
226
256
215
126
24
62
44
86
25
60
2
25
32
148
26
64
96
10
43
22
124
38
15
187
13
156
8
25
66
172
48
16
55
29
222
138
1
65
59
151
...

result:

ok 100 lines

Test #199:

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

input:

1
10000
734574461 950431396 739038911 661754887 457371894 648275232 70663160 696933069 629317065 187291071 990115579 349221249 175620434 575351736 233283750 874565547 747479053 861514245 259747128 115875033 993305117 142386663 106257110 474984733 921047496 306160480 160609288 727062411 468831737 616...

output:

9481

result:

ok single line: '9481'

Test #200:

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

input:

1
10000
308123305 394468846 469701093 641104141 1850670 378047216 708814444 917867224 911621248 861551511 861551511 901418427 581988635 495414163 942546251 310731667 862845973 751983507 29912263 29912263 404044073 262938782 173261407 657494172 328131493 497298590 351166217 19254701 741034149 6055525...

output:

8696

result:

ok single line: '8696'

Test #201:

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

input:

1
10000
881672149 988249400 790297867 770196498 986520935 107819199 757031136 843834084 898958134 535811950 535811950 662978171 79597237 375016404 164516574 533403776 996350592 906231065 903342985 548341018 115035235 793409185 172601682 550005877 224645151 926509129 27316218 27316218 466683201 62926...

output:

9437

result:

ok single line: '9437'

Test #202:

score: 0
Accepted
time: 3ms
memory: 3820kb

input:

1
10000
868190838 876341621 308151080 868190838 308151080 868190838 876341621 308151080 876341621 876341621 308151080 868190838 868190838 308151080 876341621 868190838 876341621 308151080 876341621 308151080 868190838 876341621 868190838 876341621 876341621 868190838 876341621 308151080 868190838 30...

output:

4278

result:

ok single line: '4278'

Test #203:

score: 0
Accepted
time: 2ms
memory: 3820kb

input:

1
10000
181486325 296515491 118032064 296515491 118032064 181486325 296515491 118032064 296515491 181486325 296515491 181486325 296515491 181486325 296515491 181486325 118032064 181486325 118032064 296515491 181486325 118032064 181486325 118032064 296515491 181486325 296515491 181486325 296515491 29...

output:

4728

result:

ok single line: '4728'

Test #204:

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

input:

1
10000
870064335 191125924 416845322 870064335 191125924 870064335 416845322 870064335 191125924 870064335 191125924 416845322 191125924 870064335 191125924 870064335 416845322 191125924 416845322 870064335 191125924 870064335 191125924 870064335 416845322 870064335 416845322 870064335 191125924 87...

output:

5178

result:

ok single line: '5178'

Test #205:

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

input:

1
10000
856583024 247814729 247814729 856583024 247814729 856583024 247814729 856583024 247814729 856583024 247814729 856583024 247814729 856583024 247814729 247814729 856583024 247814729 856583024 247814729 856583024 247814729 856583024 247814729 247814729 149922953 247814729 856583024 856583024 14...

output:

845

result:

ok single line: '845'

Test #206:

score: 0
Accepted
time: 2ms
memory: 3976kb

input:

1
10000
430131868 546627987 430131868 546627987 430131868 546627987 430131868 546627987 430131868 546627987 430131868 546627987 430131868 546627987 430131868 546627987 430131868 546627987 430131868 546627987 430131868 546627987 430131868 546627987 430131868 546627987 430131868 546627987 430131868 54...

output:

946

result:

ok single line: '946'

Test #207:

score: 0
Accepted
time: 6ms
memory: 3980kb

input:

1
10000
3680713 285632732 3680713 285632732 285632732 3680713 285632732 3680713 3680713 285632732 3680713 285632732 3680713 285632732 285632732 3680713 285632732 464469375 285632732 3680713 285632732 3680713 285632732 3680713 285632732 3680713 285632732 3680713 285632732 3680713 285632732 3680713 28...

output:

966

result:

ok single line: '966'

Test #208:

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

input:

1
10000
634460236 820409148 634460236 246992947 634460236 820409148 634460236 246992947 634460236 820409148 634460236 233276518 820409148 233276518 568237542 233276518 820409148 233276518 568237542 233276518 820409148 233276518 462342478 820409148 462342478 502984110 462342478 820409148 462342478 50...

output:

6833

result:

ok single line: '6833'

Test #209:

score: 0
Accepted
time: 6ms
memory: 3824kb

input:

1
10000
495302608 544963117 495302608 164529434 495302608 544963117 495302608 164529434 495302608 544963117 495302608 164529434 495302608 544963117 495302608 164529434 495302608 544963117 495302608 164529434 495302608 544963117 495302608 164529434 495302608 544963117 495302608 164529434 495302608 54...

output:

7478

result:

ok single line: '7478'

Test #210:

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

input:

1
10000
952743147 632326738 952743147 648718805 952743147 632326738 952743147 922040801 632326738 922040801 600631175 922040801 632326738 922040801 600631175 922040801 632326738 922040801 166163427 632326738 166163427 890796892 166163427 632326738 166163427 890796892 166163427 632326738 166163427 68...

output:

6840

result:

ok single line: '6840'

Test #211:

score: 0
Accepted
time: 3ms
memory: 3748kb

input:

1
10000
538400100 399973869 538400100 399973869 399973869 538400100 399973869 538400100 399973869 538400100 399973869 538400100 399973869 538400100 399973869 399973869 538400100 399973869 538400100 399973869 538400100 399973869 538400100 416882229 416882229 538400100 416882229 538400100 247323909 53...

output:

1473

result:

ok single line: '1473'

Test #212:

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

input:

1
10000
406916240 406916240 844011319 406916240 844011319 406916240 844011319 406916240 844011319 406916240 844011319 406916240 406916240 844011319 406916240 844011319 844011319 406916240 844011319 406916240 844011319 406916240 844011319 844011319 844011319 406916240 844011319 844011319 406916240 40...

output:

1349

result:

ok single line: '1349'

Test #213:

score: 0
Accepted
time: 2ms
memory: 3864kb

input:

1
10000
685497788 437791873 685497788 437791873 685497788 437791873 253382153 437791873 253382153 437791873 579183113 579183113 437791873 579183113 579183113 437791873 437791873 579183113 437791873 579183113 437791873 579183113 437791873 579183113 437791873 579183113 437791873 579183113 437791873 57...

output:

1428

result:

ok single line: '1428'

Test #214:

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

input:

1
10000
209997160 820780947 209997160 820780947 209997160 820780947 209997160 820780947 209997160 820780947 209997160 820780947 209997160 820780947 209997160 820780947 209997160 820780947 209997160 820780947 209997160 820780947 209997160 820780947 209997160 820780947 651664175 820780947 209997160 82...

output:

2246

result:

ok single line: '2246'

Test #215:

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

input:

1
10000
909920545 852829954 909920545 413056341 413056341 909920545 413056341 909920545 413056341 413056341 909920545 852829954 413056341 852829954 413056341 852829954 909920545 413056341 909920545 852829954 909920545 852829954 852829954 413056341 852829954 909920545 852829954 909920545 852829954 90...

output:

4494

result:

ok single line: '4494'

Test #216:

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

input:

1
10000
855631609 961043154 855631609 768222369 855631609 961043154 855631609 768222369 855631609 961043154 855631609 101988932 961043154 101988932 970203695 101988932 961043154 101988932 970203695 101988932 961043154 101988932 958200865 961043154 958200865 288788749 958200865 961043154 958200865 28...

output:

4112

result:

ok single line: '4112'

Test #217:

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

input:

5
1099
78 78 70 24 32 96 96 34 96 57 95 9 40 28 78 49 6 32 84 99 20 30 81 59 81 80 50 56 27 32 74 71 70 70 59 92 22 17 35 98 30 95 62 65 22 9 9 40 6 53 9 66 19 5 71 28 21 70 11 3 55 85 89 95 13 94 67 58 94 55 79 32 83 83 10 95 95 64 82 71 45 8 39 55 15 15 3 46 97 66 5 66 39 39 75 47 50 44 10 46 40 4...

output:

1000
3698
1955
38
2510

result:

ok 5 lines

Test #218:

score: 0
Accepted
time: 6ms
memory: 3744kb

input:

5
2542
54 97 54 97 47 97 47 54 97 47 54 97 54 54 47 97 47 54 47 54 97 47 97 47 54 97 54 54 97 54 97 47 97 54 47 97 54 97 54 97 54 97 54 97 54 97 54 97 54 97 54 97 47 54 54 97 54 97 47 54 97 54 97 54 97 47 97 47 97 47 54 97 54 47 97 54 97 54 54 97 97 47 97 54 47 54 47 97 54 97 47 54 97 97 47 47 97 54...

output:

1214
2320
618
197
387

result:

ok 5 lines

Test #219:

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

input:

5
80
20 41 20 41 20 41 20 41 20 41 20 10 20 42 20 10 20 10 20 10 20 10 20 10 20 10 20 10 20 10 20 10 20 10 20 10 20 10 20 10 20 10 20 10 20 10 20 10 20 20 10 20 20 10 20 84 20 10 84 20 84 84 20 84 20 84 20 84 20 84 20 84 20 8 20 84 20 84 20 20
2887
96 11 64 11 96 64 96 64 96 64 96 64 96 64 96 64 96 ...

output:

14
237
283
96
221

result:

ok 5 lines

Test #220:

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

input:

5
5164
27 89 27 33 27 89 27 33 27 89 27 33 27 89 27 33 27 89 27 33 27 89 27 33 27 89 27 33 27 89 27 33 27 89 27 70 89 70 10 70 89 70 10 70 89 70 10 70 89 70 10 70 89 70 10 70 89 70 10 70 89 70 10 70 89 70 10 70 89 70 10 70 89 70 10 70 89 70 10 70 89 70 10 70 89 70 10 70 89 70 10 70 89 70 10 70 89 70...

output:

3796
151
1561
1309
256

result:

ok 5 lines

Test #221:

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

input:

5
960
65 100 65 100 65 100 65 100 65 69 65 69 65 69 65 29 65 29 65 29 65 29 65 29 65 29 65 29 65 29 65 29 9 29 9 29 9 29 9 29 9 29 9 2 9 2 9 51 9 51 9 51 9 51 9 51 9 51 9 51 9 51 9 51 9 51 47 51 51 47 51 47 51 47 22 47 22 47 22 47 22 47 19 47 19 47 19 47 19 47 82 82 47 82 47 82 47 4 4 47 4 47 4 91 9...

output:

151
163
603
272
281

result:

ok 5 lines

Test #222:

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

input:

5
3302
64 25 64 25 25 64 25 64 25 64 25 64 25 64 25 64 25 64 25 64 25 64 25 64 64 25 64 25 64 25 25 64 64 25 64 25 64 25 64 25 64 25 64 25 64 25 64 25 64 25 64 25 64 25 64 25 64 25 64 25 64 64 64 25 64 25 27 25 44 27 44 25 44 27 25 27 25 27 25 25 27 25 27 25 25 27 25 27 25 17 25 17 25 17 25 17 25 17...

output:

253
1262
2
288
49

result:

ok 5 lines

Test #223:

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

input:

3
8744
271892247 837581997 607524695 794809165 884473726 691733000 110148098 658687030 902054061 423465795 190088609 566529866 309760669 327902716 804167805 988187078 867548935 352539955 473257188 645497998 442040811 193896907 574361509 783368870 334928397 203931404 354254999 49611706 127279475 7089...

output:

8572
163
991

result:

ok 3 lines

Test #224:

score: 0
Accepted
time: 6ms
memory: 3672kb

input:

3
3235
297227664 66298589 2554429 66298589 2554429 297227664 2554429 297227664 66298589 2554429 297227664 2554429 66298589 66298589 297227664 66298589 297227664 66298589 297227664 2554429 66298589 297227664 2554429 297227664 66298589 297227664 2554429 297227664 2554429 66298589 297227664 2554429 662...

output:

1603
144
2853

result:

ok 3 lines

Test #225:

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

input:

3
891
28183907 796280504 28183907 796280504 28183907 796280504 28183907 796280504 28183907 28183907 796280504 28183907 796280504 28183907 796280504 28183907 796280504 28183907 796280504 28183907 796280504 28183907 796280504 28183907 796280504 28183907 796280504 28183907 796280504 28183907 796280504 ...

output:

72
381
480

result:

ok 3 lines

Test #226:

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

input:

3
7196
402150913 127955569 402150913 841077227 402150913 127955569 402150913 564451461 127955569 564451461 272692136 564451461 127955569 564451461 266101277 127955569 266101277 340442723 266101277 127955569 266101277 357668733 127955569 357668733 41179751 357668733 127955569 357668733 132438946 1279...

output:

4715
943
955

result:

ok 3 lines

Test #227:

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

input:

3
9024
784475566 904722115 904722115 784475566 904722115 784475566 904722115 784475566 784475566 904722115 784475566 904722115 784475566 904722115 784475566 904722115 784475566 904722115 784475566 904722115 784475566 904722115 784475566 904722115 784475566 904722115 784475566 904722115 784475566 714...

output:

1233
110
17

result:

ok 3 lines

Test #228:

score: 0
Accepted
time: 6ms
memory: 3708kb

input:

3
852
735021932 859595884 735021932 377307463 735021932 859595884 735021932 377307463 735021932 859595884 735021932 377307463 735021932 859595884 735021932 377307463 735021932 859595884 735021932 377307463 735021932 859595884 735021932 377307463 735021932 859595884 735021932 377307463 735021932 8595...

output:

636
4134
1454

result:

ok 3 lines

Test #229:

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

input:

10
985
556318599 337558189 776606794 463992185 819447735 726997306 773524252 466489823 308046874 179638870 777091156 768589666 892786787 888619441 472311820 715549485 219808693 261065617 152205075 928412736 107638568 442628433 215985004 222248942 510561866 94453214 147491533 666716767 977078683 1025...

output:

952
838
1296
810
288
955
409
699
451
2702

result:

ok 10 lines

Test #230:

score: 0
Accepted
time: 6ms
memory: 3588kb

input:

10
1052
230579038 230579038 804150637 494625677 804150637 589225078 230579038 589225078 589225078 230579038 230579038 589225078 230579038 230579038 494625677 230579038 494625677 589225078 230579038 230579038 230579038 494625677 589225078 230579038 494625677 230579038 494625677 494625677 494625677 49...

output:

476
355
540
56
1176
413
165
788
374
405

result:

ok 10 lines

Test #231:

score: 0
Accepted
time: 6ms
memory: 3472kb

input:

10
766
904839478 715453484 904839478 715453484 904839478 715453484 904839478 715453484 904839478 715453484 904839478 715453484 904839478 715453484 904839478 715453484 904839478 715453484 715453484 904839478 715453484 904839478 715453484 904839478 715453484 904839478 715453484 904839478 904839478 715...

output:

70
6
59
167
41
59
238
121
58
79

result:

ok 10 lines

Test #232:

score: 0
Accepted
time: 6ms
memory: 3488kb

input:

10
41
473524316 219680882 473524316 663497825 473524316 219680882 473524316 663497825 473524316 219680882 473524316 663497825 473524316 219680882 473524316 363506594 219680882 363506594 483808807 363506594 219680882 363506594 289401374 219680882 289401374 244286095 289401374 219680882 289401374 3590...

output:

29
875
1218
132
154
500
740
1445
937
1082

result:

ok 10 lines

Test #233:

score: 0
Accepted
time: 6ms
memory: 3480kb

input:

10
223
958393061 533540268 958393061 533540268 958393061 533540268 958393061 533540268 958393061 533540268 958393061 533540268 958393061 533540268 958393061 533540268 958393061 533540268 958393061 533540268 958393061 563097273 958393061 563097273 958393061 563097273 958393061 213372339 958393061 213...

output:

36
115
158
170
111
62
173
122
198
388

result:

ok 10 lines

Test #234:

score: 0
Accepted
time: 6ms
memory: 3576kb

input:

10
649
410359269 200609801 410359269 362666795 410359269 200609801 410359269 362666795 410359269 200609801 410359269 323100141 200609801 323100141 733150141 323100141 200609801 323100141 733150141 323100141 200609801 323100141 186717550 200609801 186717550 785279798 186717550 200609801 186717550 785...

output:

474
175
21
116
326
28
2648
343
735
153

result:

ok 10 lines

Test #235:

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

input:

100
51
430248149 595547947 427939051 835633536 514974798 990648367 803482887 28240806 902073411 275015766 134113439 580898966 308365477 823365832 190643605 190643605 580707257 426771559 344069453 745545488 968683867 546222596 821328086 285468156 965270828 406853112 925794802 872426375 773112000 3971...

output:

50
13
66
4
111
100
119
27
159
110
110
22
135
172
42
56
102
2
51
153
28
126
4
4
2
40
88
52
36
63
62
26
168
13
66
67
69
108
313
200
33
28
23
117
66
1
28
185
58
47
9
137
2
219
101
23
29
89
47
170
68
30
350
280
171
32
137
73
16
70
17
153
16
16
29
30
142
72
68
64
62
31
98
77
320
24
93
140
289
186
73
103
...

result:

ok 100 lines

Test #236:

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

input:

100
69
131484946 970094423 131484946 970094423 131484946 970094423 83886046 970094423 131484946 970094423 83886046 970094423 131484946 83886046 131484946 83886046 131484946 970094423 131484946 83886046 131484946 83886046 970094423 131484946 83886046 970094423 131484946 83886046 131484946 83886046 13...

output:

29
111
52
91
42
5
101
9
131
27
4
19
15
3
7
27
25
58
16
14
4
113
11
39
8
41
1
2
21
95
10
16
124
13
28
52
31
64
37
19
67
15
4
52
82
104
2
137
6
19
3
94
74
45
224
40
117
58
24
19
114
10
244
77
98
8
263
47
9
180
5
65
138
34
50
17
42
104
31
64
10
76
45
27
65
53
27
248
17
2
55
30
4
7
15
46
28
18
10
10

result:

ok 100 lines

Test #237:

score: 0
Accepted
time: 2ms
memory: 3404kb

input:

100
4
159016731 655164889 159016731 655164889
84
33319647 740077354 33319647 740077354 33319647 740077354 740077354 33319647 740077354 33319647 740077354 33319647 33319647 740077354 33319647 740077354 33319647 740077354 33319647 740077354 33319647 740077354 33319647 740077354 33319647 33319647 74007...

output:

2
7
26
4
24
2
10
11
2
2
2
2
22
47
11
8
14
17
2
2
8
21
34
7
13
10
16
5
11
2
6
13
11
7
5
4
4
4
9
2
20
20
13
4
2
15
2
2
19
2
2
14
2
2
14
2
4
2
34
7
28
16
9
9
14
21
2
31
2
9
40
12
2
4
8
7
2
7
6
2
4
17
19
2
12
7
2
21
23
2
40
5
4
2
2
9
18
55
2
7

result:

ok 100 lines

Test #238:

score: 0
Accepted
time: 3ms
memory: 3292kb

input:

100
4
889287704 195011163 441162642 978768224
57
659079325 851369709 659079325 321424541 659079325 851369709 659079325 321424541 659079325 851369709 659079325 407730449 851369709 407730449 106964916 407730449 851369709 407730449 911294398 851369709 911294398 893080717 911294398 851369709 911294398 8...

output:

4
41
138
158
13
22
25
246
8
89
14
123
258
18
16
116
82
52
164
12
129
38
48
152
16
59
119
17
18
225
154
14
14
54
230
296
101
120
96
142
10
46
16
1
36
4
40
76
27
15
38
306
208
96
37
34
123
17
11
7
56
27
5
1
23
16
18
17
81
79
59
116
19
18
42
17
84
19
88
107
9
53
68
83
4
39
34
120
154
101
10
33
16
4
41
...

result:

ok 100 lines

Test #239:

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

input:

100
52
474334485 734857437 474334485 734857437 474334485 734857437 474334485 38398488 809983092 38398488 809983092 201497944 809983092 201497944 809983092 201497944 809983092 201497944 809983092 137916787 809983092 137916787 809983092 137916787 809983092 137916787 809983092 137916787 809983092 45871...

output:

10
53
6
8
10
14
10
50
11
5
25
7
6
5
8
22
2
22
10
7
17
28
4
12
17
51
11
11
11
16
10
3
11
30
17
28
14
4
2
2
21
30
5
23
27
20
27
18
7
28
4
15
12
4
2
80
25
23
11
55
10
37
45
2
5
3
3
5
16
14
16
42
43
18
25
2
25
14
6
21
6
18
28
20
4
4
6
21
1
21
15
6
2
5
4
5
43
2
2
49

result:

ok 100 lines

Test #240:

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

input:

100
40
505908428 618853372 505908428 181600193 505908428 277393924 47744413 382811698 47744413 382811698 382811698 47744413 382811698 47744413 382811698 47744413 382811698 47744413 382811698 47744413 382811698 47744413 382811698 193746294 257308980 193746294 257308980 193746294 257308980 193746294 2...

output:

12
3
22
53
40
65
19
59
21
42
44
8
32
13
25
56
18
30
19
15
37
41
15
27
50
98
22
52
4
28
16
136
33
5
137
36
7
46
18
76
47
198
22
29
49
6
82
6
89
37
35
23
4
22
87
36
7
38
15
52
42
43
25
49
66
25
51
36
58
64
31
28
17
40
99
58
16
38
122
54
99
30
90
44
15
8
12
64
103
128
60
65
23
62
6
110
16
49
18
18

result:

ok 100 lines

Test #241:

score: 0
Accepted
time: 25ms
memory: 3544kb

input:

1000
13
65469610 991719914 20100560 489070913 475381560 213845477 213845477 457600236 266497674 654005412 626941459 398562720 992704911
3
650880838 126367074 557698553
16
550741810 727995746 86825539 378942732 344477715 710837758 710837758 69212469 873261114 798025897 472932830 472932830 193023381 3...

output:

12
3
14
22
2
18
48
2
58
27
27
3
18
1
53
2
1
11
4
3
9
5
1
22
15
1
14
5
3
5
11
6
4
2
3
11
7
17
1
5
2
1
93
2
26
11
10
3
17
3
7
10
18
13
24
9
13
16
2
3
13
6
4
1
8
12
28
14
22
1
26
39
9
41
6
3
2
9
18
13
4
1
5
5
3
7
21
6
2
12
5
23
6
4
5
1
2
2
6
8
2
12
4
31
10
12
1
7
8
1
10
17
1
2
11
14
19
1
9
3
19
31
1
2
...

result:

ok 1000 lines

Test #242:

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

input:

1000
12
659817449 785903637 659817449 517000663 517000663 659817449 517000663 517000663 527199593 659817449 527199593 1664346
3
918547615 461200104 513332410
18
120221431 840760226 733945446 840760226 120221431 840760226 120221431 219199783 733945446 219199783 320934632 219199783 733945446 320934632...

output:

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

result:

ok 1000 lines

Test #243:

score: 0
Accepted
time: 3ms
memory: 3532kb

input:

1000
17
319871654 661497248 319871654 661497248 661497248 319871654 661497248 319871654 661497248 319871654 661497248 319871654 661497248 319871654 661497248 319871654 319871654
6
39553228 772818118 39553228 772818118 39553228 772818118
11
679053694 199400509 679053694 199400509 679053694 199400509 ...

output:

2
2
4
2
1
3
2
2
17
2
7
1
2
5
5
2
2
2
2
2
2
2
2
2
2
2
2
2
7
2
2
2
2
2
28
2
2
2
2
2
3
8
2
2
2
2
2
4
1
8
2
2
4
2
2
4
3
2
8
8
2
2
2
2
2
2
6
2
2
2
2
1
2
4
2
7
2
4
2
2
13
2
2
2
2
2
5
2
2
2
2
1
2
2
1
2
2
1
2
2
2
2
2
11
2
2
2
2
2
4
1
2
2
2
9
2
2
1
1
1
2
2
9
2
2
2
2
2
1
6
2
2
2
2
2
2
2
2
2
1
2
2
2
1
2
2
1
2
...

result:

ok 1000 lines

Test #244:

score: 0
Accepted
time: 12ms
memory: 3388kb

input:

1000
6
825417413 85751262 454730666 453585864 453585864 759698941
1
811367169
5
641525940 387598365 151894879 318044796 292982108
1
801662106
3
76134215 454159923 98731974
3
721571808 680208193 343700905
14
792683771 753232717 737533679 777512741 312417896 590946850 600473838 628626452 492843094 492...

output:

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

result:

ok 1000 lines

Test #245:

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

input:

1000
13
206471670 388451323 206471670 388451323 206471670 388451323 206471670 388451323 206471670 206471670 519740349 206471670 519740349
3
418074007 660597910 418074007
3
625120517 31247350 625120517
17
893102736 26378378 893102736 26378378 893102736 26378378 26378378 893102736 495201789 893102736 ...

output:

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

result:

ok 1000 lines

Test #246:

score: 0
Accepted
time: 20ms
memory: 3488kb

input:

1000
3
766541662 471465812 448211194
5
531888050 984075764 531888050 119961231 129815296
1
146934898
3
302741290 229903321 20508998
5
328635635 853953429 125675059 694949287 523746471
10
164301402 231633085 940358361 433142011 940358361 819286852 914599867 819286852 914599867 819286852
9
733957740 6...

output:

3
4
1
3
5
6
8
6
4
12
20
4
2
11
2
4
7
10
19
14
2
2
3
10
15
14
6
1
2
2
3
17
7
12
11
2
2
3
38
2
13
2
1
6
1
2
9
1
12
8
4
5
3
7
11
13
2
3
10
8
20
4
15
5
27
10
7
4
21
15
9
5
5
20
9
3
3
3
1
1
2
1
3
3
9
4
7
3
3
19
2
7
8
11
2
8
9
2
17
3
8
13
4
6
2
13
8
20
3
1
5
14
2
11
2
11
10
8
4
18
9
10
5
1
12
14
13
4
5
4
...

result:

ok 1000 lines

Subtask #7:

score: 0
Skipped

Dependency #1:

0%