QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#387107#3019. Probe DroidsInfinityNS#TL 4706ms18808kbC++172.3kb2024-04-12 02:45:422024-04-12 02:45:42

Judging History

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

  • [2024-04-12 02:45:42]
  • 评测
  • 测评结果:TL
  • 用时:4706ms
  • 内存:18808kb
  • [2024-04-12 02:45:42]
  • 提交

answer

#include<bits/stdc++.h>

#define f first
#define s second
#define sz(x) (int)(x).size()
#define all(x) (x).begin(),(x).end()
#define ll long long
#define pb push_back
using namespace std;

const int N=1e6+5;
vector<ll> x(N);
vector<ll> uzeo(N);
int n,m;
ll t;
pair<int,int> ans;
void solve(int i,int j){
    x[i]=x[i-1]+j-1;
    uzeo[i]=j-1;
    //printf("%i %i: %lld %i %i %lld\n",i,j,x[i],n,m,t);
    ll posle=m/j;
    ll j2=posle*j;
    ll ostalo=m-j2;
    int b=lower_bound(uzeo.begin(),uzeo.begin()+i,ostalo+1)-uzeo.begin()-1;
    /*for(int k=0;k<=i;k++){
        printf("%i ",uzeo[k]);
    }
    printf("\n");*/
    ll redova=min((ll)n,posle*i+b);
    //printf("%lld %lld  %lld %i\n",redova,posle,ostalo,b);
    ll k=redova/i;
    ll sm=(ll)redova*m;
    sm-=x[i]*k;
    sm-=k*(k-1)/2*j*i;
    ll ost=redova%i;
    //printf("%lld: %lld %lld\n",sm,ost*(m-j*k),x[ost]);
    sm-=ost*(j*k);
    sm-=x[ost];
    //printf("%lld!\n",sm);
    if(sm<t){
        solve(i+1,j);
        return;
    }
    int imam=min((n)/i,(m)/j);
    ll over=sm-t;
    if(over<=imam-1){
        int ind=imam-over;
        ans={i*ind,j*ind};
        return;
    }
    solve(i,j+1);
}
pair<int,int> solve(ll tt){
    t=tt;
    if(t<=m){
        return {0,t};
    }
    t-=m;
    ll kraj=n*(ll)(m+1)-t;
    if(kraj<n){
        return {n-kraj,0};
    }
    solve(1,1);
    return ans;
}
void stres(){
    for(n=0;n<=100;n++){
        for(m=0;m<=100;m++){
            //printf("%i %i:\n",n,m);
            pair<int,int> lst={0,0};
            for(ll t=1;t<(n+1)*(m+1);t++){
                pair<int,int> a=solve(t);
                ll crs=(ll)lst.f*a.s-(ll)lst.s*a.f;
                if(crs>0){
                    printf("Error! %i %i %lld\n",n,m,t);
                }
                if(crs==0){
                    int l=lst.f+lst.s,r=a.f+a.s;
                    if(l>r){
                        printf("Error 2! %i %i %lld\n",n,m,t);
                    }
                }
                //printf("%i %i %lld\n",a.f+1,a.s+1,crs);
                lst=a;
            }
        }
    }
}
int main(){
    //stres();
    int q;
    scanf("%i %i %i",&n,&m,&q);
    n--;m--;
    for(int i=0;i<q;i++){
        ll tt;
        scanf("%lld",&tt);
        pair<int,int> a=solve(tt);
        printf("%i %i\n",a.f+1,a.s+1);
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 4ms
memory: 18676kb

input:

3 5 3
1
14
8

output:

1 2
3 1
3 5

result:

ok 6 numbers

Test #2:

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

input:

1000000 1000000 100
500000000003
500000000009
499999999953
499999999971
499999999964
499999999989
499999999970
499999999984
500000000046
500000000020
500000000041
500000000022
499999999998
499999999976
500000000040
500000000025
500000000001
499999999997
499999999968
499999999967
500000000032
5000000...

output:

500004 500004
500010 500010
499954 499954
499972 499972
499965 499965
499990 499990
499971 499971
499985 499985
500047 500047
500021 500021
500042 500042
500023 500023
499999 499999
499977 499977
500041 500041
500026 500026
500002 500002
499998 499998
499969 499969
499968 499968
500033 500033
500029...

result:

ok 200 numbers

Test #3:

score: 0
Accepted
time: 4706ms
memory: 18688kb

input:

1000000 1000000 100
791524265480
310246148308
965405638061
748161462511
437425441834
859125430870
318755212730
838283037379
290597520864
840800992509
318819733413
235852029334
308150887842
829080735481
847795824828
806338877319
658498289208
599749991035
951485631667
503061373811
165065406989
4217028...

output:

881949 367730
455761 734515
545921 37772
272265 137134
159740 182591
865674 243903
137000 214898
750870 242857
532699 916558
564610 179771
440799 691298
349947 741878
488622 792829
929544 317754
703459 214139
996470 385955
660957 451436
983158 787018
726710 70512
160713 159729
236290 715746
599788 7...

result:

ok 200 numbers

Test #4:

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

input:

2 2 3
1
3
2

output:

1 2
2 1
2 2

result:

ok 6 numbers

Test #5:

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

input:

2 3 5
5
3
2
4
1

output:

2 1
2 3
1 3
2 2
1 2

result:

ok 10 numbers

Test #6:

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

input:

2 4 7
4
3
6
1
5
2
7

output:

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

result:

ok 14 numbers

Test #7:

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

input:

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

output:

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

result:

ok 18 numbers

Test #8:

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

input:

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

output:

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

result:

ok 22 numbers

Test #9:

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

input:

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

output:

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

result:

ok 26 numbers

Test #10:

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

input:

3 2 5
2
3
5
1
4

output:

2 2
3 2
3 1
1 2
2 1

result:

ok 10 numbers

Test #11:

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

input:

3 3 8
1
5
7
3
4
2
6
8

output:

1 2
3 3
2 1
2 3
2 2
1 3
3 2
3 1

result:

ok 16 numbers

Test #12:

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

input:

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

output:

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

result:

ok 22 numbers

Test #13:

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

input:

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

output:

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

result:

ok 28 numbers

Test #14:

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

input:

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

output:

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

result:

ok 34 numbers

Test #15:

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

input:

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

output:

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

result:

ok 40 numbers

Test #16:

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

input:

4 2 7
2
4
6
5
7
1
3

output:

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

result:

ok 14 numbers

Test #17:

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

input:

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

output:

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

result:

ok 22 numbers

Test #18:

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

input:

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

output:

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

result:

ok 30 numbers

Test #19:

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

input:

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

output:

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

result:

ok 38 numbers

Test #20:

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

input:

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

output:

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

result:

ok 46 numbers

Test #21:

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

input:

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

output:

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

result:

ok 54 numbers

Test #22:

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

input:

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

output:

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

result:

ok 18 numbers

Test #23:

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

input:

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

output:

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

result:

ok 28 numbers

Test #24:

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

input:

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

output:

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

result:

ok 38 numbers

Test #25:

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

input:

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

output:

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

result:

ok 48 numbers

Test #26:

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

input:

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

output:

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

result:

ok 58 numbers

Test #27:

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

input:

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

output:

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

result:

ok 68 numbers

Test #28:

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

input:

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

output:

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

result:

ok 22 numbers

Test #29:

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

input:

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

output:

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

result:

ok 34 numbers

Test #30:

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

input:

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

output:

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

result:

ok 46 numbers

Test #31:

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

input:

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

output:

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

result:

ok 58 numbers

Test #32:

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

input:

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

output:

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

result:

ok 70 numbers

Test #33:

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

input:

6 7 41
18
25
33
22
30
21
3
5
24
6
34
36
7
23
10
15
40
20
16
27
39
37
28
29
32
14
12
31
35
19
8
41
38
4
17
9
11
2
13
26
1

output:

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

result:

ok 82 numbers

Test #34:

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

input:

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

output:

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

result:

ok 26 numbers

Test #35:

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

input:

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

output:

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

result:

ok 40 numbers

Test #36:

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

input:

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

output:

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

result:

ok 54 numbers

Test #37:

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

input:

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

output:

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

result:

ok 68 numbers

Test #38:

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

input:

7 6 41
19
41
4
15
8
2
39
18
32
16
7
25
40
35
34
38
1
24
31
22
14
27
13
10
20
30
26
36
9
5
33
3
17
21
23
29
11
6
37
28
12

output:

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

result:

ok 82 numbers

Test #39:

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

input:

7 7 48
16
15
13
47
20
46
21
9
41
42
8
44
6
37
1
27
10
43
26
35
19
11
5
38
14
25
39
7
12
33
45
23
17
40
18
34
4
24
28
36
48
22
2
30
29
3
31
32

output:

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

result:

ok 96 numbers

Test #40:

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

input:

1 2 1
1

output:

1 2

result:

ok 2 number(s): "1 2"

Test #41:

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

input:

2 1 1
1

output:

2 1

result:

ok 2 number(s): "2 1"

Test #42:

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

input:

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

output:

1 37
1 30
1 73
1 7
1 24
1 44
1 53
1 62
1 39
1 41
1 46
1 61
1 65
1 70
1 95
1 63
1 77
1 33
1 56
1 2
1 88
1 71
1 57
1 29
1 31
1 21
1 51
1 98
1 99
1 35
1 13
1 78
1 32
1 9
1 85
1 96
1 74
1 14
1 40
1 5
1 50
1 67
1 45
1 94
1 16
1 89
1 36
1 64
1 28
1 83
1 22
1 34
1 69
1 68
1 52
1 87
1 3
1 84
1 79
1 15
1 17
...

result:

ok 198 numbers

Test #43:

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

input:

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

output:

84 1
47 1
24 1
30 1
50 1
89 1
75 1
88 1
35 1
25 1
22 1
44 1
74 1
58 1
71 1
90 1
53 1
57 1
86 1
13 1
26 1
65 1
2 1
10 1
68 1
93 1
51 1
14 1
36 1
80 1
29 1
98 1
20 1
42 1
31 1
38 1
27 1
8 1
41 1
83 1
70 1
62 1
95 1
32 1
85 1
11 1
66 1
43 1
45 1
77 1
54 1
34 1
16 1
46 1
72 1
6 1
18 1
48 1
7 1
81 1
28 1...

result:

ok 198 numbers

Test #44:

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

input:

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

output:

1 2
2 28
1 11
2 9
2 13
2 34
1 10
2 18
2 48
1 38
2 29
1 8
2 4
2 17
1 29
2 20
2 49
1 4
1 37
2 33
1 16
2 6
1 21
2 39
1 24
1 19
1 30
1 39
1 9
1 44
1 35
1 27
2 30
2 47
1 25
2 12
1 23
2 14
1 48
1 7
1 41
2 5
2 24
1 43
1 40
2 1
2 8
2 38
2 21
1 32
1 3
2 42
1 26
1 36
1 47
2 19
1 5
1 46
1 14
2 40
2 41
2 11
2 4...

result:

ok 198 numbers

Test #45:

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

input:

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

output:

32 1
5 1
27 1
43 1
42 1
7 1
17 2
46 1
37 2
25 1
39 2
34 2
47 1
25 2
3 2
33 2
18 2
15 1
40 2
12 2
49 2
17 1
10 1
41 2
29 2
14 1
1 2
44 1
2 2
35 1
48 1
6 2
43 2
39 1
22 2
6 1
9 1
21 2
13 2
20 1
45 2
41 1
50 2
24 1
16 1
5 2
15 2
38 2
21 1
14 2
3 1
19 2
8 2
40 1
30 2
10 2
38 1
28 2
46 2
29 1
18 1
35 2
2...

result:

ok 198 numbers

Test #46:

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

input:

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

output:

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

result:

ok 198 numbers

Test #47:

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

input:

1000 1000 100
510555
312387
671343
361108
806086
173321
59994
899848
760540
914332
955428
735661
352082
78397
417736
181170
832652
345563
89380
607659
81312
151614
424505
221111
937218
770539
290189
121246
108709
16604
832833
232139
841855
914364
350073
994045
730966
661669
532376
411377
432594
8928...

output:

569 557
523 837
998 656
284 393
830 322
83 238
49 404
838 168
950 455
652 112
579 52
586 310
657 933
115 732
777 930
188 518
486 163
678 981
151 844
632 496
128 786
276 910
484 570
160 361
835 105
926 425
545 939
213 878
113 518
6 156
999 334
276 594
584 185
840 144
507 724
734 9
360 194
449 304
541...

result:

ok 200 numbers

Test #48:

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

input:

1000 1000 100
476106
107946
422053
560259
518513
536545
754007
893753
858544
582867
292964
341317
626006
214897
60705
266259
3239
247724
638484
196293
972601
352785
669779
829171
763546
513730
670118
862339
339717
680154
721842
499785
829756
24083
534824
724337
248872
88308
699415
581342
583486
3200...

output:

857 900
132 610
531 629
946 832
865 833
329 305
353 174
582 124
894 253
441 368
583 995
437 640
885 662
286 665
92 756
250 469
6 921
197 397
524 379
382 973
261 15
616 873
763 504
262 90
526 249
838 815
139 92
926 255
674 992
916 586
717 399
286 286
566 193
34 700
460 428
856 472
92 184
62 348
264 1...

result:

ok 200 numbers

Test #49:

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

input:

1000 1000 100
64973
157042
423068
933834
831150
529927
950080
762736
829709
794300
773422
613681
104343
282427
806848
820154
828582
565749
276705
89857
150407
380278
142444
985334
324210
36159
546494
418187
90168
534379
439825
218540
56079
405969
205808
552210
895633
842625
538734
515792
803861
2038...

output:

108 830
263 837
391 462
678 90
811 274
919 864
567 57
828 393
760 259
556 229
940 426
726 561
80 381
369 653
644 249
338 122
755 259
548 476
309 558
140 778
278 924
480 631
238 835
918 27
454 700
16 211
839 761
583 697
171 948
495 461
826 939
417 954
89 792
678 835
329 799
996 892
958 200
520 164
99...

result:

ok 200 numbers

Test #50:

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

input:

1000 1000 100
489875
295824
299433
456366
885157
995948
615361
587712
822475
467290
812302
583946
16706
776342
489920
653095
385729
218327
196468
666772
874494
455602
770785
67723
762598
396056
51096
961098
819904
921645
449437
386752
764410
955831
608517
441527
817919
923953
132439
920430
103069
72...

output:

823 840
244 412
314 524
701 768
582 134
987 8
434 334
878 724
966 343
843 902
580 218
840 699
31 926
959 429
341 348
709 492
446 578
233 533
134 340
684 456
976 245
575 631
844 387
73 536
973 462
138 174
48 465
781 61
535 193
649 102
880 979
383 495
955 450
653 58
627 491
446 505
884 322
563 86
71 2...

result:

ok 200 numbers

Test #51:

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

input:

1000 1000 100
828170
523569
867318
181651
540402
288882
694656
65512
529995
327292
785459
895370
933959
379965
839439
319716
261493
803206
399161
411379
385634
468417
903653
437946
528669
39194
946694
722106
40603
396065
995466
873127
122319
100680
408108
643443
927407
961779
164265
211562
496242
98...

output:

587 202
764 728
787 209
137 376
681 626
266 460
273 167
102 777
817 768
580 886
715 307
946 198
504 67
393 517
363 117
194 303
384 734
884 348
681 853
460 559
624 809
727 776
913 176
572 653
576 543
34 427
351 38
543 302
80 985
648 818
249 3
918 233
31 124
148 734
795 974
687 490
680 99
875 67
101 3...

result:

ok 200 numbers

Test #52:

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

input:

1000000 1 100
349195
614431
495432
878077
971946
319420
880758
205876
11869
384669
577847
253888
753049
194578
227838
914858
860186
918141
391982
671661
122047
349768
269288
674350
537109
98875
297189
637331
697030
282240
287480
723346
501166
33718
627189
76550
443703
292273
658723
597850
229603
466...

output:

349196 1
614432 1
495433 1
878078 1
971947 1
319421 1
880759 1
205877 1
11870 1
384670 1
577848 1
253889 1
753050 1
194579 1
227839 1
914859 1
860187 1
918142 1
391983 1
671662 1
122048 1
349769 1
269289 1
674351 1
537110 1
98876 1
297190 1
637332 1
697031 1
282241 1
287481 1
723347 1
501167 1
33719...

result:

ok 200 numbers

Test #53:

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

input:

1 1000000 100
861047
889293
933203
810797
514048
541749
637394
824023
831269
697026
982892
778561
212733
187275
961008
355605
372634
787214
199285
666498
495884
959791
296819
210893
160718
601339
887620
995184
945538
974074
184065
460381
498607
53531
671011
923615
215832
213514
382834
982022
820277
...

output:

1 861048
1 889294
1 933204
1 810798
1 514049
1 541750
1 637395
1 824024
1 831270
1 697027
1 982893
1 778562
1 212734
1 187276
1 961009
1 355606
1 372635
1 787215
1 199286
1 666499
1 495885
1 959792
1 296820
1 210894
1 160719
1 601340
1 887621
1 995185
1 945539
1 974075
1 184066
1 460382
1 498608
1 5...

result:

ok 200 numbers

Test #54:

score: 0
Accepted
time: 3994ms
memory: 18668kb

input:

1000000 999995 100
309361518202
355557415435
703381388428
849053256823
574331650926
589668045094
948339246201
753057846167
919419683984
707444842331
54076554548
905474832736
580600183382
220939264004
387885173937
384243329702
266925890805
94218823932
647902773564
381644162591
960200428792
1436351891...

output:

601510 972170
235346 330950
926301 549507
617277 186346
816744 695316
743702 610322
924785 95541
647711 319888
694839 111974
466065 272695
50583 467689
928738 175569
824699 691749
430299 973785
81505 105062
491277 639272
345418 647023
70674 375046
886201 624049
569112 745598
859299 68391
198947 6925...

result:

ok 200 numbers

Test #55:

score: 0
Accepted
time: 4001ms
memory: 18660kb

input:

999995 1000000 100
188535204293
535161372588
265378020860
942848537604
99380636177
825878342383
647208794449
332652620210
786350846107
736882135621
236143167037
342676272867
976284540072
724118666442
475910887836
208591317997
580375091519
109963325862
754306201605
838988700816
62392577016
1470752801...

output:

343794 911750
824590 766602
502186 946171
455295 52038
78894 396926
549763 191448
234767 165647
665097 999687
994871 425101
657956 346237
256464 543026
57060 83256
630826 29915
808740 446229
354349 372285
388944 932311
823033 690729
205602 934866
441983 217183
945146 304352
113016 905684
206836 7031...

result:

ok 200 numbers

Test #56:

score: 0
Accepted
time: 1579ms
memory: 18712kb

input:

1000000 10000 100
958159266
9201027451
3537801715
1079434779
5145410737
1424930070
8168126892
4663452017
6848835122
3631645867
4962821751
2485380711
4488530284
1747159404
8440265835
8071852313
3262240397
6420912480
6169222576
7455022972
6782912529
5432038011
3969510089
4922232389
5538577238
90053323...

output:

159243 8310
924891 1478
682581 9647
209712 9714
812614 7890
284701 9990
303052 1111
782046 8385
971541 6123
321506 4427
947696 9548
299817 6032
514617 5733
238791 6834
785963 2452
900839 3474
224922 3448
830216 5943
942360 7220
870513 4431
579652 3730
470612 4300
786518 9907
588266 5976
340289 3037
...

result:

ok 200 numbers

Test #57:

score: 0
Accepted
time: 725ms
memory: 18660kb

input:

10000 1000000 100
8761594359
9680663466
4160067778
2894184299
6775494247
9104593498
2579102206
4467366033
652850119
8174026207
4028580222
7509158742
3448500183
2710324713
6711765057
9385978044
7749460448
578673990
6047903750
464869649
82251404
8055189800
4438107606
3449170327
273665868
9246765056
80...

output:

9042 223951
7102 45357
3978 478055
2662 459795
7780 501719
4359 78052
4593 890405
8472 948204
1084 830076
7253 264866
3192 396095
4230 210697
5242 760006
2612 481766
4865 319912
6994 85886
4806 216299
833 719507
5370 424419
882 948598
66 397551
8001 311201
8710 981272
2392 346656
448 818185
9743 146...

result:

ok 200 numbers

Test #58:

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

input:

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

output:

1 17
1 96
1 13
1 61
1 29
1 24
1 48
1 51
1 49
1 54
1 86
1 99
1 64
1 52
1 101
1 42
1 43
1 66
1 100
1 21
1 65
1 44
1 38
1 37
1 55
1 25
1 27
1 19
1 78
1 95
1 77
1 70
1 15
1 58
1 69
1 5
1 79
1 84
1 57
1 35
1 28
1 4
1 53
1 63
1 94
1 90
1 98
1 16
1 76
1 56
1 68
1 72
1 6
1 45
1 26
1 92
1 22
1 46
1 85
1 39
1...

result:

ok 200 numbers

Test #59:

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

input:

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

output:

34 1
95 1
90 1
96 1
4 1
50 1
77 1
43 1
54 1
24 1
63 1
32 1
53 1
9 1
44 1
51 1
38 1
68 1
67 1
17 1
87 1
85 1
18 1
64 1
58 1
98 1
7 1
36 1
65 1
27 1
99 1
39 1
31 1
20 1
101 1
89 1
22 1
12 1
29 1
25 1
52 1
26 1
2 1
66 1
46 1
75 1
10 1
71 1
49 1
23 1
62 1
91 1
93 1
83 1
60 1
84 1
88 1
13 1
41 1
8 1
5 1
...

result:

ok 200 numbers

Test #60:

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

input:

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

output:

1 47
1 21
1 82
1 63
1 39
1 16
1 10
1 84
1 59
1 53
1 70
1 93
1 58
1 78
1 26
1 99
1 50
1 91
1 4
1 86
1 34
1 51
1 31
1 81
1 8
1 9
1 90
1 44
1 35
1 74
1 42
1 48
1 55
1 22
1 6
1 75
1 94
1 92
1 20
1 27
1 62
1 49
1 23
1 38
1 101
1 77
1 40
1 32
1 19
1 54
1 67
1 80
1 88
1 56
1 73
1 71
1 65
1 68
1 24
1 72
1 1...

result:

ok 200 numbers

Test #61:

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

input:

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

output:

1 93
1 89
1 64
1 78
1 73
1 31
1 43
1 17
1 8
1 97
1 68
1 99
1 37
1 85
1 7
1 6
1 44
1 35
1 19
1 18
1 27
1 55
1 33
1 23
1 95
1 3
1 24
1 38
1 66
1 87
1 98
1 40
1 39
1 22
1 26
1 15
1 34
1 82
1 83
1 2
1 49
1 46
1 77
1 84
1 70
1 51
1 16
1 10
1 58
1 13
1 67
1 50
1 20
1 4
1 88
1 81
1 11
1 41
1 36
1 96
1 65
1...

result:

ok 200 numbers

Test #62:

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

input:

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

output:

1 23
1 44
1 54
1 80
1 95
1 31
1 62
1 73
1 57
1 25
1 5
1 64
1 65
1 91
1 77
1 32
1 10
1 50
1 48
1 83
1 53
1 59
1 33
1 9
1 28
1 55
1 46
1 37
1 13
1 86
1 21
1 12
1 70
1 89
1 35
1 6
1 76
1 78
1 69
1 97
1 51
1 66
1 68
1 74
1 94
1 93
1 52
1 100
1 67
1 18
1 98
1 14
1 3
1 58
1 24
1 30
1 72
1 15
1 63
1 99
1 4...

result:

ok 200 numbers

Test #63:

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

input:

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

output:

1 95
1 5
1 31
1 64
1 90
1 60
1 66
1 61
1 44
1 80
1 45
1 33
1 7
1 92
1 88
1 78
1 19
1 49
1 23
1 63
1 57
1 65
1 87
1 85
1 91
1 12
1 81
1 18
1 86
1 72
1 28
1 96
1 8
1 62
1 100
1 24
1 17
1 13
1 54
1 82
1 56
1 50
1 75
1 69
1 30
1 74
1 9
1 2
1 36
1 25
1 6
1 53
1 10
1 67
1 98
1 39
1 37
1 16
1 15
1 29
1 89
...

result:

ok 200 numbers

Test #64:

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

input:

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

output:

1 4
1 26
1 10
1 56
1 82
1 59
1 76
1 100
1 57
1 97
1 40
1 5
1 31
1 34
1 6
1 71
1 98
1 70
1 62
1 61
1 24
1 49
1 84
1 55
1 77
1 87
1 73
1 8
1 58
1 36
1 93
1 3
1 101
1 92
1 52
1 28
1 48
1 95
1 91
1 12
1 35
1 15
1 64
1 81
1 23
1 80
1 60
1 44
1 33
1 67
1 63
1 7
1 65
1 86
1 94
1 96
1 68
1 53
1 30
1 18
1 14...

result:

ok 200 numbers

Test #65:

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

input:

1000000 1 100
499962
500024
499999
499978
499957
499960
499956
500031
499975
500045
499991
500032
500003
500017
499989
499981
500029
500026
500013
499977
499986
499990
499967
499973
499965
499998
500027
500009
500022
499994
500011
499951
499970
499964
500030
499982
500018
500010
500005
499958
500037...

output:

499963 1
500025 1
500000 1
499979 1
499958 1
499961 1
499957 1
500032 1
499976 1
500046 1
499992 1
500033 1
500004 1
500018 1
499990 1
499982 1
500030 1
500027 1
500014 1
499978 1
499987 1
499991 1
499968 1
499974 1
499966 1
499999 1
500028 1
500010 1
500023 1
499995 1
500012 1
499952 1
499971 1
499...

result:

ok 200 numbers

Test #66:

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

input:

1 1000000 100
499975
500016
499989
499974
499995
500027
500017
500015
500011
499990
499962
499973
500005
500041
500025
500031
499976
500039
499968
499955
500030
500049
499996
500020
500004
500044
499979
500000
500006
499978
499970
499950
500036
500001
499972
499992
499954
500012
500029
500026
499991...

output:

1 499976
1 500017
1 499990
1 499975
1 499996
1 500028
1 500018
1 500016
1 500012
1 499991
1 499963
1 499974
1 500006
1 500042
1 500026
1 500032
1 499977
1 500040
1 499969
1 499956
1 500031
1 500050
1 499997
1 500021
1 500005
1 500045
1 499980
1 500001
1 500007
1 499979
1 499971
1 499951
1 500037
1 5...

result:

ok 200 numbers

Test #67:

score: -100
Time Limit Exceeded

input:

1000000 999995 100
499997500040
499997500033
499997499978
499997500032
499997500022
499997499999
499997499963
499997499955
499997500021
499997499953
499997499966
499997499997
499997499998
499997500007
499997499985
499997500011
499997500001
499997500015
499997499974
499997500041
499997499993
49999750...

output:


result: