QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#113125#2789. Sortingmyee100 ✓211ms28532kbC++112.7kb2023-06-16 14:47:492023-06-16 14:47:51

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-16 14:47:51]
  • 评测
  • 测评结果:100
  • 用时:211ms
  • 内存:28532kb
  • [2023-06-16 14:47:49]
  • 提交

answer

#include "sorting.h"
#include <algorithm>
#include <stdio.h>
#include <vector>

namespace
{

typedef long long llt;
typedef unsigned uint;typedef unsigned long long ullt;
typedef bool bol;typedef char chr;typedef void voi;
typedef double dbl;
template<typename T>bol _max(T&a,T b){return(a<b)?a=b,true:false;}
template<typename T>bol _min(T&a,T b){return(b<a)?a=b,true:false;}
template<typename T>T lowbit(T n){return n&-n;}
template<typename T>T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T>T lcm(T a,T b){return(a!=0||b!=0)?a/gcd(a,b)*b:(T)0;}
template<typename T>T exgcd(T a,T b,T&x,T&y){if(b!=0){T ans=exgcd(b,a%b,y,x);y-=a/b*x;return ans;}else return y=0,x=1,a;}
template<typename T>T power(T base,T index,T mod)
{
    T ans=1%mod;
    while(index)
    {
        if(index&1)ans=ans*base%mod;
        base=base*base%mod,index>>=1;
    }
    return ans;
}

std::vector<std::pair<uint,uint> >solve(std::vector<uint>A,std::vector<std::pair<uint,uint> >B)
{
    uint n=A.size();
    std::vector<uint>Now=A;uint p=0;
    auto roll=[&](uint t)
    {
        while(p<t)std::swap(Now[B[p].first],Now[B[p].second]),p++;
        while(p>t)p--,std::swap(Now[B[p].first],Now[B[p].second]);
    };
    auto get=[&]()
    {
        static bol B[200005];
        for(uint i=0;i<n;i++)B[i]=false;
        std::vector<std::vector<uint> >V;
        for(uint i=0;i<n;i++)if(!B[i])
        {
            V.push_back({i}),B[i]=true;
            while(!B[Now[V.back().back()]])V.back().push_back(Now[V.back().back()]),B[V.back().back()]=true;
        }
        return V;
    };
    uint l=0,r=n;
    while(l<r)
    {
        uint mid=(l+r)>>1,s=0;roll(mid);auto t=get();for(auto v:t)s+=v.size()-1;
        if(s>mid)l=mid+1;else r=mid;
    }
    roll(l);
    std::vector<std::pair<uint,uint> >Ans;
    auto t=get();
    for(auto s:t)for(uint j=1;j<s.size();j++)Ans.push_back({s[0],s[j]});
    while(Ans.size()<l)Ans.push_back({0,0});
    std::vector<uint>Back(n);
    for(uint i=0;i<n;i++)Now[i]=Back[i]=i;
    for(uint i=l-1;~i;i--)
        std::swap(Now[B[i].first],Now[B[i].second]),std::swap(Back[Now[B[i].first]],Back[Now[B[i].second]]);
    for(uint i=0;i<l;i++)
        std::swap(Now[B[i].first],Now[B[i].second]),std::swap(Back[Now[B[i].first]],Back[Now[B[i].second]]),
        Ans[i]={Back[Ans[i].first],Back[Ans[i].second]};
    return Ans;
}

}

int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
    std::vector<uint>A(N);
    std::vector<std::pair<uint,uint> >B(N);
    for(int i=0;i<N;i++)A[i]=S[i],B[i]={X[i],Y[i]};
    B=solve(A,B);
    for(int i=0;i<(int)B.size();i++)P[i]=B[i].first,Q[i]=B[i].second;
    return B.size();
}

/*

g++ 233.cpp grader.cpp -o code -std=c++11

*/

详细

Subtask #1:

score: 8
Accepted

Test #1:

score: 8
Accepted
time: 1ms
memory: 3176kb

input:

1
0
1
0 0

output:

0

result:

ok correct

Test #2:

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

input:

2
0 1
4
0 0
0 0
0 0
0 0

output:

0

result:

ok correct

Test #3:

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

input:

2
1 0
4
0 0
0 0
0 0
0 0

output:

1
0 1

result:

ok correct

Test #4:

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

input:

3
1 0 2
9
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0

output:

1
0 1

result:

ok correct

Test #5:

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

input:

4
3 2 0 1
16
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0

output:

3
0 3
0 1
0 2

result:

ok correct

Test #6:

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

input:

5
1 4 2 3 0
25
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0

output:

2
0 1
0 4

result:

ok correct

Test #7:

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

input:

5
4 2 1 0 3
25
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0

output:

3
0 4
0 3
1 2

result:

ok correct

Subtask #2:

score: 12
Accepted

Test #8:

score: 12
Accepted
time: 1ms
memory: 3104kb

input:

1
0
30
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0

output:

0

result:

ok correct

Test #9:

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

input:

2
0 1
60
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0

output:

0

result:

ok correct

Test #10:

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

input:

98
82 70 31 12 27 51 84 90 66 8 49 52 74 91 46 7 96 67 63 85 34 50 87 83 58 78 26 39 77 48 2 55 94 25 61 56 53 13 32 86 72 20 37 73 9 93 65 28 18 11 71 59 88 35 76 40 24 36 33 3 17 29 38 5 21 15 79 30 62 92 45 80 64 95 43 75 97 23 16 57 22 60 41 69 0 42 14 10 47 68 19 4 1 6 44 81 54 89
2940
0 0
0 0
...

output:

93
0 82
0 41
0 20
0 34
0 61
0 29
0 48
0 18
0 63
0 5
0 51
0 59
0 3
0 12
0 74
0 43
0 73
0 95
0 81
0 60
0 17
0 67
0 30
0 2
0 31
0 55
0 40
0 72
0 64
0 21
0 50
0 71
0 80
0 22
0 87
0 10
0 49
0 11
0 52
0 88
0 47
0 28
0 77
0 23
0 83
0 69
0 92
0 1
0 70
0 45
0 93
0 6
0 84
4 27
4 39
4 86
4 14
4 46
4 65
4 15
4 ...

result:

ok correct

Test #11:

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

input:

99
8 14 3 0 98 74 18 10 50 93 49 23 80 2 54 79 90 31 66 38 81 36 42 83 39 7 9 71 59 62 67 4 68 5 70 72 34 95 25 27 45 61 97 48 29 15 46 12 87 22 26 63 77 84 11 85 30 24 40 78 41 1 96 69 94 19 6 65 33 13 52 75 88 82 86 20 92 43 89 47 28 73 35 32 53 60 21 16 37 58 44 76 57 56 17 55 91 51 64
2970
0 0
0...

output:

92
0 8
0 50
0 26
0 9
0 93
0 56
0 30
0 67
0 65
0 19
0 38
0 25
0 7
0 10
0 49
0 22
0 42
0 97
0 51
0 63
0 69
0 13
0 2
0 3
1 14
1 54
1 11
1 23
1 83
1 32
1 68
1 33
1 5
1 74
1 86
1 21
1 36
1 34
1 70
1 52
1 77
1 43
1 48
1 87
1 16
1 90
1 44
1 29
1 62
1 96
1 91
1 76
1 92
1 57
1 24
1 39
1 27
1 71
1 75
1 20
1 8...

result:

ok correct

Test #12:

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

input:

96
12 91 75 59 44 30 52 63 41 13 93 79 82 60 85 78 50 53 57 8 80 67 34 24 87 17 47 33 83 21 81 40 89 49 32 70 26 9 43 7 11 37 94 36 23 28 90 42 35 25 62 56 20 84 55 45 46 22 77 51 0 69 1 31 54 2 3 58 88 76 5 6 65 92 39 66 15 95 10 27 14 86 72 4 68 18 38 19 64 73 71 74 48 29 61 16
2880
0 0
0 0
0 0
0 ...

output:

95
0 12
0 82
0 72
0 65
0 2
0 75
0 66
0 3
0 59
0 51
0 56
0 46
0 90
0 71
0 6
0 52
0 20
0 80
0 14
0 85
0 18
0 57
0 22
0 34
0 32
0 89
0 73
0 92
0 48
0 35
0 70
0 5
0 30
0 81
0 86
0 38
0 43
0 36
0 26
0 47
0 42
0 94
0 61
0 69
0 76
0 15
0 78
0 10
0 93
0 29
0 21
0 67
0 58
0 77
0 95
0 16
0 50
0 62
0 1
0 91
0 ...

result:

ok correct

Subtask #3:

score: 16
Accepted

Test #13:

score: 16
Accepted
time: 1ms
memory: 2960kb

input:

2
0 1
60
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1

output:

0

result:

ok correct

Test #14:

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

input:

5
0 4 1 3 2
150
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
...

output:

2
0 4
1 2

result:

ok correct

Test #15:

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

input:

96
7 15 12 95 11 50 20 42 81 29 58 80 56 71 63 66 44 6 64 39 2 22 73 1 24 27 69 28 45 25 60 61 5 94 14 65 9 86 68 32 79 37 3 57 34 35 10 88 76 78 21 93 19 53 84 52 4 33 38 55 62 67 77 41 31 48 91 49 51 43 90 8 87 54 16 17 70 46 85 0 75 92 74 47 36 89 30 13 59 26 40 18 82 83 72 23
2880
0 1
0 1
0 1
0 ...

output:

91
0 15
1 66
0 91
1 18
0 64
1 31
0 61
1 67
0 49
1 78
0 85
1 89
0 26
1 69
0 43
1 57
0 33
1 94
0 72
1 87
0 13
1 71
0 8
1 81
0 92
1 82
0 74
1 16
0 44
1 34
0 14
1 63
0 41
1 37
0 86
1 30
0 60
1 62
0 77
1 46
0 10
1 58
0 38
1 68
0 51
1 93
0 83
1 47
0 88
1 59
0 55
1 52
0 19
1 39
0 32
1 5
0 50
1 21
0 22
1 73...

result:

ok correct

Test #16:

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

input:

99
28 2 16 95 73 6 30 90 18 46 82 69 59 4 40 49 33 29 66 86 97 56 22 96 38 35 67 15 83 44 36 72 81 41 76 47 34 87 65 9 92 57 0 55 68 5 32 17 61 50 14 19 58 24 98 48 53 60 45 12 39 3 8 74 88 77 13 85 84 42 79 51 94 70 10 25 75 31 62 27 64 1 80 78 21 37 7 63 52 23 71 20 54 26 43 91 89 93 11
2970
0 1
0...

output:

92
1 28
0 83
1 78
0 62
1 8
0 18
1 66
0 13
1 4
0 73
1 70
0 79
1 27
0 15
1 49
0 50
1 14
0 40
1 92
0 54
1 98
0 11
1 69
0 42
0 2
1 16
0 33
1 41
0 57
1 60
0 39
1 9
0 46
1 32
0 81
3 95
3 91
3 20
3 97
3 93
3 26
3 67
3 85
3 37
3 87
3 63
3 74
3 10
3 82
3 80
3 64
3 88
3 52
3 58
3 45
3 5
3 6
3 30
3 36
3 34
3 7...

result:

ok correct

Test #17:

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

input:

99
52 0 59 91 38 87 65 75 48 11 64 60 95 71 62 79 49 30 47 56 33 16 94 8 78 36 13 68 9 35 74 77 80 24 15 83 28 66 12 51 92 84 43 40 4 46 63 57 17 85 42 25 81 14 50 31 72 34 70 88 67 53 6 37 44 45 96 69 2 86 76 55 3 82 22 5 93 39 26 41 98 7 27 1 20 29 23 19 54 18 61 90 89 32 97 73 10 58 21
2970
0 1
0...

output:

97
1 52
0 81
1 7
0 75
1 5
0 87
1 19
0 56
1 72
0 3
1 91
0 90
1 61
0 53
1 14
0 62
1 6
0 65
1 45
0 46
1 63
0 37
1 66
0 96
1 10
0 64
1 44
0 4
1 38
0 12
1 95
0 73
1 82
0 27
1 68
0 2
1 59
0 88
1 54
0 50
1 42
0 43
1 40
0 92
1 89
0 18
1 47
0 57
1 34
0 15
1 79
0 41
1 84
0 20
1 33
0 24
1 78
0 26
1 13
0 71
1 5...

result:

ok correct

Test #18:

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

input:

4
0 1 3 2
120
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 ...

output:

2
2 3
0 0

result:

ok correct

Subtask #4:

score: 18
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #19:

score: 18
Accepted
time: 1ms
memory: 2952kb

input:

1
0
30
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0

output:

0

result:

ok correct

Test #20:

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

input:

2
0 1
60
1 0
0 1
1 0
0 1
1 0
0 1
1 0
0 1
0 1
1 0
0 1
0 1
1 0
0 1
0 1
0 1
1 0
1 0
0 1
1 0
0 1
1 0
1 0
1 0
1 0
1 0
0 1
0 1
0 1
1 0
1 0
1 0
1 0
1 0
1 0
1 0
0 1
1 0
0 1
1 0
0 1
1 0
0 1
1 0
1 0
0 1
1 0
1 0
0 1
1 0
1 0
0 1
0 1
0 1
0 1
1 0
0 1
1 0
1 0
1 0

output:

0

result:

ok correct

Test #21:

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

input:

481
264 22 307 266 238 227 68 26 13 12 384 162 410 306 374 311 442 38 407 310 280 308 333 146 326 381 367 110 190 33 141 468 153 393 157 415 229 75 276 392 349 348 179 445 317 64 78 20 323 257 292 395 129 259 165 398 151 219 14 116 338 188 243 61 150 84 72 340 155 133 459 464 248 433 124 399 177 62 ...

output:

473
118 381
118 307
118 144
118 186
118 167
118 242
118 328
118 41
118 437
118 63
118 457
118 276
118 209
118 380
118 292
118 31
118 388
118 311
118 293
118 21
118 26
118 214
118 347
118 448
118 239
118 310
118 98
118 106
118 284
118 142
118 398
118 23
118 410
118 36
118 229
118 202
118 195
118 423
...

result:

ok correct

Test #22:

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

input:

478
458 446 125 326 318 327 263 67 453 296 46 116 270 440 323 38 181 235 415 412 95 365 133 397 157 441 348 223 459 449 149 168 59 107 171 262 328 450 289 314 141 139 29 393 211 477 146 239 433 142 269 145 342 155 238 172 206 23 108 31 48 117 180 424 50 147 325 468 161 291 272 130 93 472 245 207 154...

output:

476
374 450
374 119
374 195
374 161
374 446
374 187
374 167
374 189
374 258
374 407
374 456
374 150
374 210
374 273
374 121
374 158
374 305
374 141
374 112
374 242
374 318
374 303
452 127
452 77
452 428
452 181
452 48
452 413
452 347
452 309
452 370
452 382
452 469
452 388
452 236
452 125
452 66
452...

result:

ok correct

Test #23:

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

input:

496
426 495 20 100 83 50 3 247 94 52 290 45 179 160 344 239 270 133 492 398 131 476 271 436 69 351 401 494 111 76 393 432 431 207 53 350 24 288 278 359 413 253 181 166 186 336 35 173 209 448 352 364 188 434 203 38 439 32 328 285 213 112 47 128 136 303 49 180 444 132 177 114 287 475 161 483 14 108 66...

output:

490
106 482
106 349
106 246
106 426
106 155
106 116
106 333
106 33
106 257
106 192
106 163
106 474
106 238
106 245
106 217
106 399
106 122
106 108
106 231
106 318
106 410
106 480
106 169
106 423
106 471
106 143
106 134
106 6
106 388
106 292
106 78
106 55
106 64
106 75
106 186
106 266
106 332
106 223...

result:

ok correct

Test #24:

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

input:

484
307 290 7 454 181 133 142 213 413 207 146 153 236 111 320 453 476 103 316 158 235 388 150 155 329 297 196 345 335 197 173 0 156 59 357 85 161 280 229 98 412 187 42 226 244 203 99 475 223 81 56 309 273 87 159 317 50 313 199 366 185 409 172 483 447 427 71 284 330 30 73 414 154 70 302 417 113 107 2...

output:

422
0 405
0 70
0 73
0 91
0 456
0 282
0 426
0 449
0 118
0 171
0 462
0 307
0 31
412 339
412 225
412 308
412 40
412 1
412 206
412 122
412 120
412 188
412 285
412 367
412 341
412 423
412 92
412 397
412 125
412 19
412 158
412 296
412 224
412 270
412 364
412 76
412 411
412 445
412 138
412 68
412 358
412 5...

result:

ok correct

Test #25:

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

input:

496
145 300 465 228 235 186 373 183 142 208 278 11 410 286 392 245 44 470 211 368 283 240 265 120 30 68 71 158 263 356 439 243 27 311 86 134 201 33 319 371 254 181 231 89 214 435 113 59 48 151 317 143 320 195 377 426 408 303 22 47 149 330 180 175 412 140 102 204 381 441 50 258 232 105 266 52 122 423...

output:

145
2 465
228 198
4 235
12 410
12 438
14 392
470 471
19 239
20 283
21 240
23 120
23 165
71 258
27 158
27 32
263 282
30 24
33 37
34 86
34 110
35 476
38 319
40 363
42 231
42 342
43 89
45 435
46 113
50 317
50 70
195 95
54 377
54 148
55 426
55 417
303 406
58 265
61 330
65 140
65 446
102 325
67 204
67 11...

result:

ok correct

Test #26:

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

input:

478
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 365 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

270
246 89
246 17
246 233
246 132
246 436
246 376
246 298
246 290
246 163
246 189
246 265
246 197
246 453
246 102
246 28
246 270
246 174
246 393
246 227
246 470
246 159
246 266
246 262
246 255
246 148
246 112
246 456
246 462
246 127
246 319
246 368
246 256
246 82
246 1
277 190
277 381
277 21
277 211...

result:

ok correct

Test #27:

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

input:

476
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 129 91 92 93 94 95 96 97 98 99 100 1...

output:

473
361 285
361 136
361 121
361 219
361 282
361 137
361 444
361 77
361 273
361 273
361 264
361 316
361 156
361 313
361 167
361 388
361 314
361 35
361 42
361 57
361 329
361 274
361 127
361 146
361 199
361 337
361 408
361 141
361 111
361 357
361 233
361 464
361 181
361 457
361 201
361 18
361 61
361 8
...

result:

ok correct

Subtask #5:

score: 20
Accepted

Test #28:

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

input:

1800
530 1775 466 953 230 1179 944 752 990 1316 275 1029 158 152 1673 1706 172 115 599 1661 131 699 1112 454 551 1059 291 495 28 67 773 480 839 462 1210 757 879 285 439 3 1429 820 26 1023 942 199 356 625 1705 1421 144 1529 716 7 1485 1027 1599 696 517 1353 456 1389 273 1363 1414 1177 718 41 777 1621...

output:

1794
0 530
0 288
0 1704
0 346
0 1543
0 941
0 475
0 576
0 965
0 1091
0 194
0 1005
0 1734
0 1664
0 139
0 1736
0 1406
0 713
0 1157
0 1310
0 1342
0 1323
0 1671
0 1156
0 1727
0 486
0 633
0 513
0 1499
0 104
0 1712
1140 260
1140 1248
1140 1171
1140 613
1140 53
1140 7
1140 752
1140 643
1140 1190
1140 522
11...

result:

ok correct

Test #29:

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

input:

1950
1718 335 1071 714 1080 1828 1472 410 553 1269 297 401 1021 621 1763 528 205 1231 406 5 715 876 1474 1110 653 862 838 291 1092 549 955 1334 1044 300 1070 720 1877 484 1597 1948 1078 28 87 1193 505 1024 1259 63 852 960 633 1573 713 504 15 820 1852 752 1601 1168 471 1903 499 693 1209 1492 56 908 9...

output:

1944
0 1718
0 1717
0 688
0 1910
0 683
0 969
0 625
0 692
0 1932
0 1788
0 1452
0 580
0 1787
0 898
0 794
0 1648
0 551
0 884
0 518
0 595
0 1337
0 1890
0 591
0 1801
0 1364
0 198
0 1444
0 1883
0 1942
0 1464
0 265
0 1426
0 949
0 964
0 1336
0 384
0 1267
0 350
0 1867
0 854
0 1744
0 997
0 1491
0 987
0 134
0 7...

result:

ok correct

Test #30:

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

input:

1853
452 1299 444 1527 510 1801 34 1178 1589 1782 342 1800 735 761 879 999 1122 1772 236 566 1459 1256 1149 1498 1827 1027 715 1377 6 306 1811 950 500 890 196 1825 1568 1157 943 1422 475 1237 1792 1796 1363 1217 889 968 1439 1116 322 795 1088 1358 1833 96 118 543 1337 207 876 1144 805 215 1433 903 1...

output:

1844
1804 1019
1804 248
1804 462
1804 1795
1804 1216
1804 1583
1804 1826
1804 685
1804 319
1804 620
1804 144
1804 690
1804 86
1804 775
1804 1448
1804 244
1804 370
1804 504
1804 724
1804 1173
1804 866
1804 180
1804 1531
1804 305
1804 467
1804 1551
1804 554
1804 853
1804 801
1804 670
1804 232
1804 132...

result:

ok correct

Test #31:

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

input:

1957
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

0

result:

ok correct

Test #32:

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

input:

1993
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

134
540 5
1610 25
1604 27
1305 39
831 65
679 295
679 66
776 67
1991 68
121 69
1306 71
1381 81
101 90
1892 93
133 113
115 955
885 124
157 563
1479 169
1256 200
1739 201
1580 205
1896 1693
1896 1200
1896 206
1912 210
1583 213
214 1829
214 1486
1057 230
460 237
271 1156
271 245
248 1383
1006 250
1957 2...

result:

ok correct

Test #33:

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

input:

1935
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

377
475 516
475 0
1156 591
1156 848
1156 1
355 640
355 5
1612 1317
1612 1185
1612 570
1612 18
883 20
247 173
247 26
62 1638
62 593
62 508
62 420
62 1196
62 459
62 27
1504 34
855 199
855 1929
855 39
554 43
46 359
46 1259
514 53
1017 54
389 56
870 336
870 1226
870 59
1205 60
178 1685
178 63
250 502
25...

result:

ok correct

Test #34:

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

input:

1999
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 127 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

1080
1901 229
1901 192
1901 1396
1901 907
1901 1983
1901 1763
1901 1526
1901 1317
1901 1969
1901 579
1901 242
1901 1885
1901 657
1901 1411
1901 352
1901 1246
1901 1461
1901 606
1901 767
1901 1687
1901 329
1901 177
1901 1264
1901 1471
1901 1766
1901 1171
1901 1934
1901 595
1901 1274
1901 1356
1901 65...

result:

ok correct

Test #35:

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

input:

1901
952 410 986 1281 736 1411 1256 622 375 1423 718 1153 1238 643 120 1336 1097 881 1140 1395 1195 847 925 967 280 1859 966 360 815 770 634 1774 1359 1871 1589 618 991 571 1704 170 1548 1791 225 741 1561 35 1334 1632 203 894 728 1681 1849 22 1152 1719 701 1886 1037 1309 1576 993 1350 1643 893 1888 ...

output:

1897
245 1303
245 673
245 865
245 124
245 1400
245 1220
245 551
245 91
245 812
245 1161
245 276
245 409
245 379
245 1560
245 1723
245 442
245 480
245 1599
245 1273
245 632
245 183
245 964
245 82
245 561
245 1826
245 1579
245 1091
245 434
245 425
245 43
245 741
245 778
245 253
245 1095
245 1797
245 5...

result:

ok correct

Test #36:

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

input:

1931
1361 1614 1425 1627 1210 1778 166 420 1747 1792 1060 1914 611 833 1280 86 1754 1194 762 185 488 1368 1794 1153 1466 1689 1185 168 1622 1582 959 197 103 1809 1586 436 633 853 463 738 820 630 159 398 150 1370 558 281 1849 483 1691 350 1867 1871 1392 1791 1697 926 639 1865 1063 1726 262 1009 495 1...

output:

1923
722 1396
722 1257
722 760
722 1869
722 1486
722 1062
722 1006
722 957
722 1770
722 279
722 1661
722 954
722 1676
722 680
722 510
722 71
722 1316
722 392
722 116
722 1542
722 75
722 1814
722 636
722 302
722 563
722 336
722 746
722 569
722 967
722 639
722 1054
722 380
722 751
722 1172
722 1743
72...

result:

ok correct

Test #37:

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

input:

1938
428 1641 1051 1154 1556 814 986 237 1557 1082 84 1382 1823 1591 1779 1565 193 574 1683 1259 405 393 366 644 612 562 303 1567 997 1422 868 132 74 1508 1002 965 1752 500 1148 529 1119 1841 930 1608 1472 310 1435 261 705 908 588 1710 722 1427 1825 1256 1175 379 45 902 1861 62 729 1303 759 766 1022...

output:

1928
1202 1706
1202 698
1202 976
680 522
680 1904
680 1765
680 413
680 359
680 1220
680 666
680 1540
680 1075
680 316
680 809
680 724
680 1843
680 103
680 713
680 1472
680 1848
680 1751
680 662
680 1006
680 839
680 1895
680 1735
680 373
680 1541
680 7
680 450
680 600
680 234
680 1063
680 76
680 326
...

result:

ok correct

Test #38:

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

input:

1997
1053 110 1738 1025 1245 1257 472 471 13 1215 1811 1371 476 1631 1028 892 1191 20 1323 868 435 1063 870 758 1538 155 1105 27 987 1345 1228 1473 452 1092 1561 1874 1417 95 252 565 1315 1389 533 1078 1259 1440 772 0 1588 1750 1451 644 659 1161 173 200 1680 1040 1827 1567 1069 12 1730 866 1493 65 5...

output:

1693
0 1207
0 893
0 1053
0 30
0 1228
0 47
1 110
1 71
1 1749
1 1043
1 1822
1 569
1 180
1 1694
1 174
1 137
2 562
2 308
2 1320
2 1677
2 498
2 625
2 1417
2 36
2 1661
2 1034
2 1000
2 497
2 1692
2 1814
2 837
2 96
2 687
2 399
2 937
2 1341
2 432
2 1016
2 83
2 1613
2 1961
2 661
2 241
2 1921
2 692
2 890
2 110...

result:

ok correct

Test #39:

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

input:

1989
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

1091
1898 239
1898 249
1898 257
1898 1136
1898 1348
1898 1067
1898 221
1898 71
1898 1835
1898 931
1898 934
1898 1934
1898 1859
1898 969
1898 1357
1898 1016
1898 1618
1898 585
1898 1565
1898 1928
1898 327
1898 645
1898 1412
1898 463
1898 393
1898 10
1898 538
1898 1368
1898 434
1898 877
1898 1541
1898...

result:

ok correct

Test #40:

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

input:

1961
0 1 272 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100...

output:

1959
59 1813
59 1624
59 902
59 107
59 837
59 1669
59 12
59 1280
59 1006
59 1690
59 386
59 134
59 583
59 1261
59 1176
59 1908
59 183
59 866
59 596
59 229
59 1796
59 1565
59 447
59 507
59 352
507 153
507 1703
507 1818
507 398
507 1917
507 1882
507 939
507 1340
507 1170
507 1095
507 496
507 1829
507 14...

result:

ok correct

Test #41:

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

input:

1905
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

2
1471 1779
0 0

result:

ok correct

Subtask #6:

score: 26
Accepted

Dependency #5:

100%
Accepted

Test #42:

score: 26
Accepted
time: 62ms
memory: 16544kb

input:

176900
167810 159384 90550 63101 76883 19925 161149 18578 132157 136198 141834 156609 167914 129523 2878 165972 95279 65282 30261 94853 37236 41515 166488 123502 141101 86565 153657 72526 396 92614 23189 1661 167567 100107 155037 35542 99140 171977 171544 123048 107611 71527 111368 88756 149185 9360...

output:

176885
0 167810
0 2442
0 129909
0 10456
0 139016
0 16821
0 25194
0 38200
0 72113
0 156123
0 73507
0 15987
0 8779
0 73201
0 41963
0 73728
0 104548
0 21921
0 132871
0 50262
0 67776
0 89205
0 59769
0 70978
0 43252
0 21251
0 99992
0 15545
0 108827
0 93901
0 86933
0 115184
0 90810
0 124863
0 153627
0 172...

result:

ok correct

Test #43:

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

input:

180601
172380 49504 27207 3423 41891 140536 126137 40192 90592 127987 124918 9486 152764 76028 76578 51283 40029 108361 93576 1341 36411 19763 103182 57530 103033 111456 32419 24822 89698 42054 101746 78793 103184 136054 135074 170297 146325 170251 21191 78975 68633 116257 103827 106102 162889 14512...

output:

180588
0 172380
0 168244
0 97345
0 179767
0 3522
0 53384
0 40305
0 116195
0 175196
0 22381
0 59886
0 97301
0 130722
0 7410
0 67366
0 123979
0 70729
0 74345
0 108401
0 144895
0 99570
0 111784
0 4653
0 49957
0 158304
0 125064
0 93420
0 48994
0 11819
0 113743
0 90386
0 82262
0 62865
0 57699
0 13626
0 6...

result:

ok correct

Test #44:

score: 0
Accepted
time: 87ms
memory: 17520kb

input:

190000
155277 81364 16113 73641 59637 140074 33594 60852 167804 149502 15249 35894 69246 132504 37548 26618 81511 141393 147548 24346 7165 123128 175784 74022 121283 80377 116823 111912 149688 96762 34103 104558 142346 82209 136360 40339 28418 119696 9573 42868 81005 59704 115658 173964 158009 43922...

output:

189985
6338 146707
6338 41152
6338 65051
6338 170369
6338 171879
6338 134705
6338 42599
6338 112108
6338 189903
6338 12820
6338 142391
6338 161399
6338 58449
6338 173900
6338 133
6338 163695
6338 103882
6338 63886
6338 36462
6338 48540
6338 16104
6338 12667
6338 12156
6338 135309
6338 162078
6338 11...

result:

ok correct

Test #45:

score: 0
Accepted
time: 178ms
memory: 26064kb

input:

183960
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100...

output:

0

result:

ok correct

Test #46:

score: 0
Accepted
time: 200ms
memory: 26612kb

input:

195464
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100...

output:

89748
78364 35842
78364 9672
78364 65683
78364 71027
78364 8319
78364 21063
78364 184974
78364 43582
78364 52244
78364 2
178167 26246
178167 75666
178167 3
32977 192010
32977 120858
32977 4
161202 152290
161202 177561
161202 148422
161202 41601
161202 11783
161202 69582
161202 77206
161202 76526
161...

result:

ok correct

Test #47:

score: 0
Accepted
time: 199ms
memory: 21856kb

input:

199973
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100...

output:

100444
43027 60918
43027 191912
43027 112584
43027 29121
43027 5965
43027 187333
43027 35442
43027 9484
43027 96328
43027 53623
43027 91415
43027 184199
43027 189219
43027 102511
43027 155298
43027 24510
43027 53454
43027 36471
43027 128544
43027 163798
43027 34688
43027 166282
43027 1810
43027 9127...

result:

ok correct

Test #48:

score: 0
Accepted
time: 211ms
memory: 21620kb

input:

199961
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100...

output:

102949
45437 113317
45437 15314
45437 130320
45437 28357
45437 86954
45437 56867
45437 140646
45437 126919
45437 126291
45437 50834
45437 0
82218 111436
82218 78746
82218 185065
82218 67580
82218 78965
82218 66147
82218 1
23204 55244
23204 24779
23204 72016
23204 2
12788 6329
12788 4
106408 93284
10...

result:

ok correct

Test #49:

score: 0
Accepted
time: 87ms
memory: 16712kb

input:

193129
36602 123872 92038 45146 138692 111345 188441 38874 91571 40957 134717 29367 19348 43950 30107 169548 95423 20615 37890 24013 43534 56756 81846 81665 44142 51120 180128 191175 155099 72840 184568 93861 80314 90359 189897 714 93862 77927 44624 23382 86361 118437 115484 86518 100371 84582 12335...

output:

193113
0 123872
1 75351
0 118305
0 96670
0 8239
0 130070
1 125631
0 187123
1 151269
1 60095
1 126436
0 180628
1 12796
1 63684
1 9189
0 72029
1 156588
0 104689
0 59064
0 55835
0 45741
1 111153
0 143650
0 18446
0 21009
1 180176
1 1483
0 190427
1 79740
1 41735
1 48336
1 51288
1 68887
1 189458
1 13570
1...

result:

ok correct

Test #50:

score: 0
Accepted
time: 102ms
memory: 18512kb

input:

197082
28948 99935 148708 46451 122696 180672 62930 125162 102390 178828 36655 81146 108094 50099 58749 177353 187400 182745 51049 117239 46107 132994 126349 134844 20491 77064 156426 77316 106562 74474 181231 51810 115214 17483 98735 11537 154284 152530 31318 32324 150103 162145 377 111950 32190 84...

output:

197073
0 99936
0 69870
0 47187
0 20668
0 16450
0 169317
0 61373
0 104142
0 84498
0 29276
0 148425
0 53247
0 64833
0 53969
0 176038
0 86522
0 45511
0 78034
0 132258
0 97032
0 176118
0 20511
0 37993
0 12419
0 177017
0 105034
0 131685
0 50462
0 31303
0 69540
0 27171
0 118006
0 90464
0 72564
0 1130
0 17...

result:

ok correct

Test #51:

score: 0
Accepted
time: 86ms
memory: 17880kb

input:

194300
41456 157650 130220 26552 100104 39688 171793 93878 171968 42386 15076 119236 116984 147030 178130 84543 41422 78012 62905 182069 27860 51578 123684 182555 79509 132548 171199 184307 163260 137221 40321 193521 22658 163921 153451 81135 146421 61739 37826 184064 100949 1221 27789 179291 15206 ...

output:

194290
0 41456
0 127559
0 47547
0 34824
0 189317
0 97502
0 36639
0 120581
0 185290
0 136251
0 44453
0 93233
0 123611
0 9477
0 174033
0 138813
0 61783
0 26823
0 102272
0 151312
0 181653
0 15326
0 183508
0 169765
0 105542
0 26207
0 66087
0 1012
0 117711
0 5137
0 39468
0 7681
0 134569
0 108215
0 158293...

result:

ok correct

Test #52:

score: 0
Accepted
time: 95ms
memory: 18112kb

input:

191745
86160 177973 190897 101427 58207 52429 103273 57783 65873 49221 161353 23941 99019 125297 40852 27805 14133 40994 81091 37037 21432 47533 119915 102063 92390 79753 118310 157456 132054 38761 115430 33036 71721 54738 176381 140861 147078 36903 123109 71733 46877 173730 187571 7820 33867 26827 ...

output:

191732
63702 102245
63702 178160
63702 126792
63702 73223
63702 117546
63702 146663
63702 180892
63702 39341
63702 145938
63702 67540
63702 61612
63702 131999
63702 8754
63702 57037
63702 146041
63702 144943
63702 128678
63702 145318
63702 103747
63702 23994
63702 182504
63702 117679
63702 41305
637...

result:

ok correct

Test #53:

score: 0
Accepted
time: 164ms
memory: 23708kb

input:

199993
196446 158206 8206 10499 39868 129031 121632 148457 183086 75548 11957 13065 15359 17847 118402 17577 159823 30468 24361 103231 121626 59655 36996 187439 89929 192793 20197 28808 16555 137308 105716 56425 198490 164384 8584 47629 83558 155060 148041 175988 3886 132588 15792 32028 104991 14846...

output:

99996
0 196446
0 101789
0 129894
0 32635
0 39319
0 21631
0 83562
0 118012
0 194794
0 128307
0 49435
0 46625
0 5331
0 167664
0 67990
0 192319
0 162310
0 123627
0 12784
0 65632
0 7866
0 134293
0 196934
0 80808
0 115655
0 110003
0 196465
0 175369
0 90710
0 54438
0 192091
0 145398
0 100849
0 191314
0 85...

result:

ok correct

Test #54:

score: 0
Accepted
time: 174ms
memory: 22808kb

input:

195962
0 143495 94457 139954 64590 53700 118663 178237 93365 76238 190312 47039 180296 27740 3019 173316 180035 69779 93653 122287 57697 21 119951 130009 15368 145558 129234 63611 55030 29 189665 107778 157921 184944 79827 118642 86050 82957 86225 39 29493 124696 114418 173586 84617 177846 170864 11...

output:

84206
1 143495
1 148363
1 29310
1 181952
1 19282
1 109813
1 151571
1 86790
1 136930
1 186627
1 55396
1 24886
1 74252
1 152247
1 182883
1 12945
1 44337
1 82085
1 124424
1 135405
1 79585
1 150078
1 4579
1 12183
1 64675
1 112044
1 50163
1 193463
1 35578
1 184926
1 148807
1 95649
1 136026
1 117173
1 415...

result:

ok correct

Test #55:

score: 0
Accepted
time: 103ms
memory: 18740kb

input:

194842
100154 140138 48998 98453 130678 177133 46195 8423 62509 72873 77452 122206 42181 60275 170586 2358 7988 89849 185284 193691 59370 185794 5218 23270 118843 81380 57130 150638 52947 187734 187310 168413 153988 136321 38186 163329 189331 126207 137943 84857 145378 167961 161479 69302 31915 1202...

output:

182153
0 100154
0 95131
0 27280
0 135143
0 189310
0 114024
0 162064
0 158889
0 170024
0 78028
0 136058
0 36032
0 14067
0 96467
0 11605
0 95869
0 89014
0 1170
0 37977
0 42369
0 27472
0 104181
0 65169
0 75750
0 148051
0 8918
0 119086
0 114970
0 150502
0 160262
0 116823
0 163885
0 2353
0 163344
0 50203...

result:

ok correct

Test #56:

score: 0
Accepted
time: 136ms
memory: 18396kb

input:

192864
140597 66570 121427 116752 26792 80717 160186 76426 8 89413 178636 77175 26030 47446 80214 37113 6890 186652 99224 16670 42488 160907 6475 13753 93053 55091 124543 86129 121212 126899 190219 159959 130785 94656 182197 40626 190748 71684 29400 127366 187275 144333 66541 159353 56469 45 46 1133...

output:

165493
0 168482
0 97123
0 112021
0 127924
0 132514
0 69346
0 165008
0 97351
0 47707
0 73530
0 124293
0 104878
0 10651
0 154164
0 33029
0 177445
0 19433
0 54445
0 27168
0 91173
0 46925
0 117434
0 55197
0 140597
0 81100
1 121097
1 179059
1 68449
1 105908
1 140470
1 31965
1 109780
1 66570
2 80919
2 179...

result:

ok correct

Test #57:

score: 0
Accepted
time: 200ms
memory: 27584kb

input:

197205
69791 7278 144655 44140 100294 77302 123723 171433 104856 173242 169410 67899 36966 171145 136488 47079 48081 152021 59592 5911 4574 162108 173932 54582 62863 110098 59669 47193 129654 106687 152256 89688 184321 178761 50076 26558 84676 120349 3492 76839 83222 138603 78108 16086 42321 191702 ...

output:

49301
1 7278
2 144655
3 44140
4 100294
5 77302
6 123723
8 104856
9 173242
11 67899
13 171145
15 47079
17 152021
19 5911
22 173932
24 62863
26 59669
27 47193
31 89688
32 184321
33 178761
35 26558
37 120349
38 3492
39 76839
43 16086
45 191702
47 87915
48 101863
49 13181
50 283
52 178223
55 69114
56 43...

result:

ok correct

Test #58:

score: 0
Accepted
time: 126ms
memory: 19276kb

input:

197131
84406 80027 110287 44746 131371 146934 42426 65970 150332 170783 65657 1953 162645 190993 109274 124958 51133 84371 52975 45289 169245 91663 107556 94239 181471 104596 71086 182854 165285 38597 66664 7262 124939 9815 82726 155117 130064 161982 165615 141978 54973 19100 50015 109085 117973 118...

output:

168671
0 84865
0 6792
0 85557
0 72726
0 48789
0 143935
0 84406
1 80027
2 110287
3 44746
4 131371
66828 76945
66828 44293
66828 136412
66828 112579
66828 30264
66828 174315
66828 15751
66828 152805
66828 133124
66828 122993
66828 165817
66828 30843
66828 48879
66828 54746
66828 82795
66828 182782
668...

result:

ok correct

Test #59:

score: 0
Accepted
time: 89ms
memory: 17844kb

input:

190716
70694 127495 127683 172932 35760 161055 89535 88848 86329 70488 159904 154657 123716 114250 17532 30359 18636 56168 87024 174259 84439 39232 146857 23700 109966 77964 87980 58575 44910 187918 44705 123208 129478 100467 24819 82211 54590 167945 186629 189101 150929 88606 28837 150355 60022 149...

output:

190706
0 70694
0 153598
0 179635
0 110171
0 69544
0 25660
0 179587
0 17581
0 83473
0 14426
0 29162
0 131204
0 169487
0 47050
0 19439
0 119597
0 83082
0 13869
0 121261
0 60839
0 6840
0 1188
0 52130
0 88728
0 104933
0 164663
0 182842
0 123293
0 87844
0 32204
0 133741
0 101282
0 31141
0 11814
0 79021
0...

result:

ok correct

Test #60:

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

input:

193898
85269 174015 77811 28051 118737 97733 40719 89809 27239 143398 80856 147511 63066 169396 188622 137055 75691 19603 26753 21153 38282 19883 184352 116056 74924 109097 83545 91598 188816 130408 12005 58299 179552 132499 184991 172525 19246 46965 82109 14127 45042 61971 139287 156790 158325 1053...

output:

193877
59438 173698
59438 59400
59438 152126
59438 49910
59438 82582
59438 139558
59438 36722
59438 24955
59438 115201
59438 189825
59438 32733
59438 86085
59438 80691
59438 21242
59438 98030
59438 18138
59438 160841
59438 26949
59438 86861
59438 46553
59438 168674
59438 66230
59438 70392
59438 7160...

result:

ok correct

Test #61:

score: 0
Accepted
time: 84ms
memory: 16604kb

input:

193451
73331 167267 1859 26632 182171 73089 171348 172101 254 125155 89420 155531 85116 116670 120195 104715 81962 173779 54516 70099 186190 71017 67533 23137 114603 120956 148961 4395 85938 127836 173745 186046 50370 28206 98366 112565 66018 46642 74053 48767 7112 15058 176808 908 73048 45225 60762...

output:

193228
0 73331
0 157177
0 47256
0 165751
0 162115
0 62605
0 94110
0 15077
0 157074
0 80119
0 83835
0 146144
0 16069
0 125494
0 82592
0 121640
0 33269
0 165246
0 163495
0 38193
0 21518
0 68896
0 191585
0 54845
0 61732
0 62859
0 24910
0 154423
0 114377
0 181581
0 83603
0 79413
0 54400
0 130895
0 16522...

result:

ok correct

Test #62:

score: 0
Accepted
time: 193ms
memory: 25376kb

input:

191762
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100...

output:

95351
159419 84650
159419 156008
159419 133877
159419 47932
159419 62518
159419 34269
159419 94936
159419 55439
159419 134881
159419 93548
159419 150108
159419 158345
159419 187205
159419 166803
159419 33444
159419 135960
159419 98158
159419 70948
159419 64346
159419 149828
159419 131950
159419 1833...

result:

ok correct

Test #63:

score: 0
Accepted
time: 154ms
memory: 28532kb

input:

198205
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100...

output:

2
152764 139084
0 0

result:

ok correct

Test #64:

score: 0
Accepted
time: 92ms
memory: 20000kb

input:

199700
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100...

output:

199698
112395 77106
112395 131593
112395 198207
112395 11975
112395 36824
112395 91202
112395 104627
112395 110565
112395 168736
112395 36713
112395 131592
112395 171328
112395 72621
112395 119521
112395 123217
112395 135224
112395 100300
112395 79986
112395 39504
112395 106460
112395 159952
112395 ...

result:

ok correct

Test #65:

score: 0
Accepted
time: 97ms
memory: 18984kb

input:

191786
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100...

output:

191784
117979 73089
117979 144030
117979 38264
117979 36395
117979 88337
117979 160138
117979 15394
117979 45945
117979 85190
117979 30201
117979 62542
117979 33699
117979 38654
117979 47107
117979 133688
117979 143638
117979 77972
117979 155599
117979 183819
117979 168069
117979 25337
117979 19553
...

result:

ok correct

Test #66:

score: 0
Accepted
time: 95ms
memory: 19092kb

input:

193072
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100...

output:

193069
162746 164541
162746 38491
162746 17133
162746 185092
162746 134620
162746 109463
162746 25187
162746 123322
162746 1730
162746 39965
162746 80180
162746 13916
162746 184582
162746 174436
162746 62384
162746 162756
162746 105812
162746 41619
162746 119188
162746 32768
162746 154342
162746 319...

result:

ok correct