QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#491670#2784. AliensWansur23 162ms58364kbC++232.4kb2024-07-25 20:54:382024-07-25 20:54:40

Judging History

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

  • [2024-07-25 20:54:40]
  • 评测
  • 测评结果:23
  • 用时:162ms
  • 内存:58364kb
  • [2024-07-25 20:54:38]
  • 提交

answer

#include <bits/stdc++.h>
#define ent '\n'
#define f first
#define s second

typedef long long ll;
using namespace std;
const int maxn = 1e6+12;

pair<ll, int> dp[maxn];
vector<int> g[maxn];
bool was[maxn];
vector<int> t;
int L[maxn];
int R[maxn];
int n, m;

struct line{
    ll k, b;
    int c;
};

bool check(line nw, line last, line prl){
    if((nw.b - prl.b) * (prl.k - last.k) <= (last.b - prl.b) * (prl.k - nw.k))return 1;
    return 0;
}

int ptr = 0;
vector<line> l;

void add(line x){
    while(l.size() && l.back().k == x.k && l.back().b > x.b){
        l.pop_back();
    }
    if(l.size() && l.back().k == x.k && l.back().b <= x.b){
        return;
    }
    while(l.size()>1 && check(x, l.back(), l[l.size()-2])){
        l.pop_back();
    }
    l.push_back(x);
}

pair<ll, int> get(ll x){
    if(!l.size()){
        return {1e18, 1e9};
    }
    if(ptr >= l.size()){
        ptr = l.size()-1;
    }
    while(ptr + 1 < l.size() && l[ptr].k * x + l[ptr].b > l[ptr+1].k * x + l[ptr+1].b){
        ptr++;
    }
    return {l[ptr].k * x + l[ptr].b, l[ptr].c + 1};
}

int check(ll k){
    add({0, 0, 0});
    for(int &i:t){
        dp[i] = get(i);
        dp[i].f += i * 1ll * i + k;
        for(int &j:g[i]){
            ll b = j * 1ll * j + dp[R[j]].f, c = dp[R[j]].s;
            if(R[j] > j) b -= (R[j] - j) * 1ll * (R[j] - j);
            add(line(-2 * j, b, c));
        }
    }
    l.clear();
    ptr = 0;
    return dp[m].s;
}

long long take_photos(int N, int M, int k, vector<int> r, vector<int> c){
    n = N, m = M;
    for(int i=1;i<=m;i++){
        L[i] = 1e9;
    }
    m = 0;
    for(int i=0;i<n;i++){
        if(r[i] < c[i]){
            swap(r[i], c[i]);
        }
        r[i]++, c[i]++;
        L[r[i]] = min(L[r[i]], c[i]);
        R[c[i]] = max(R[c[i]], r[i]);
        for(int x=-1;x<=0;x++){
            was[r[i]+x] = was[c[i]+x] = 1;
        }
        m = max(m, r[i]);
    }
    was[1] = 1;
    for(int i=1;i<=m;i++){
        R[i] = max(R[i], R[i-1]);
        if(!was[i]) continue;
        t.push_back(i);
        g[max(R[i], i)].push_back(i);
    }
    ll val = 0;
    for(ll l = -2e12, r = 2e12; l <= r;){
        ll mid = l + r >> 1;
        if(check(mid) >= k){
            val = mid;
            l = mid + 1;
        }
        else r = mid - 1;
    }
    check(val);
    return dp[m].f - dp[m].s * val;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 4
Accepted

Test #1:

score: 4
Accepted
time: 2ms
memory: 9964kb

input:

2 6 2
1 4
4 1

output:

098d134608c94f7413faac591054ee35
16

result:

ok Correct answer: answer = 16

Test #2:

score: 4
Accepted
time: 2ms
memory: 9912kb

input:

1 2 1
0 1

output:

098d134608c94f7413faac591054ee35
4

result:

ok Correct answer: answer = 4

Test #3:

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

input:

2 2 2
0 0
1 0

output:

098d134608c94f7413faac591054ee35
4

result:

ok Correct answer: answer = 4

Test #4:

score: 4
Accepted
time: 2ms
memory: 9920kb

input:

2 3 2
0 1
1 1

output:

098d134608c94f7413faac591054ee35
4

result:

ok Correct answer: answer = 4

Test #5:

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

input:

4 4 4
1 3
0 1
2 1
2 2

output:

098d134608c94f7413faac591054ee35
12

result:

ok Correct answer: answer = 12

Test #6:

score: 4
Accepted
time: 2ms
memory: 9944kb

input:

5 8 5
0 5
2 6
7 4
4 5
2 6

output:

098d134608c94f7413faac591054ee35
52

result:

ok Correct answer: answer = 52

Test #7:

score: 4
Accepted
time: 2ms
memory: 9940kb

input:

8 20 8
6 14
5 13
1 8
17 15
6 9
1 9
2 0
17 8

output:

098d134608c94f7413faac591054ee35
210

result:

ok Correct answer: answer = 210

Test #8:

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

input:

10 10 10
2 2
3 6
8 6
8 3
6 9
4 0
8 4
8 1
0 8
8 9

output:

098d134608c94f7413faac591054ee35
88

result:

ok Correct answer: answer = 88

Test #9:

score: 4
Accepted
time: 1ms
memory: 9908kb

input:

10 100 10
98 25
55 31
36 25
38 77
9 82
11 69
88 42
47 49
19 91
61 13

output:

098d134608c94f7413faac591054ee35
7696

result:

ok Correct answer: answer = 7696

Test #10:

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

input:

50 1 50
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
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:

098d134608c94f7413faac591054ee35
1

result:

ok Correct answer: answer = 1

Test #11:

score: 4
Accepted
time: 2ms
memory: 9944kb

input:

50 50 50
25 25
44 12
46 47
4 26
10 35
10 3
13 27
14 16
6 28
10 0
27 46
2 19
10 36
29 49
13 16
6 38
32 48
33 33
47 45
8 13
5 21
14 25
21 41
47 49
26 7
4 7
5 34
5 24
16 24
18 26
29 10
32 39
14 39
35 32
11 1
49 17
24 18
38 14
32 48
46 1
45 46
17 36
29 31
24 48
12 33
4 44
38 32
11 6
25 47
9 49

output:

098d134608c94f7413faac591054ee35
2374

result:

ok Correct answer: answer = 2374

Test #12:

score: 4
Accepted
time: 2ms
memory: 9916kb

input:

50 100 50
0 20
49 26
21 27
10 67
79 9
38 75
39 27
36 51
75 81
70 37
57 74
57 64
13 76
53 95
25 11
62 37
78 38
39 19
46 7
92 71
40 27
73 11
30 55
60 67
79 48
3 69
1 27
41 54
80 40
50 50
9 49
75 11
90 62
2 71
14 40
30 48
3 53
68 24
99 25
8 49
35 80
31 24
21 11
92 9
4 97
45 61
56 83
68 75
35 84
77 20

output:

098d134608c94f7413faac591054ee35
9502

result:

ok Correct answer: answer = 9502

Test #13:

score: 4
Accepted
time: 2ms
memory: 10008kb

input:

49 7 49
5 3
0 6
6 2
3 3
4 2
3 4
0 3
1 3
2 4
5 1
1 0
2 1
3 0
4 4
1 6
0 5
1 4
6 3
6 6
6 5
4 0
3 5
5 5
2 0
4 5
3 2
0 2
1 5
2 5
6 4
1 1
5 0
0 4
6 0
5 4
2 6
0 1
5 2
4 6
5 6
3 1
3 6
0 0
4 3
1 2
2 2
4 1
2 3
6 1

output:

098d134608c94f7413faac591054ee35
49

result:

ok Correct answer: answer = 49

Test #14:

score: 4
Accepted
time: 2ms
memory: 10172kb

input:

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

output:

098d134608c94f7413faac591054ee35
151

result:

ok Correct answer: answer = 151

Test #15:

score: 4
Accepted
time: 2ms
memory: 9944kb

input:

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

output:

098d134608c94f7413faac591054ee35
7550

result:

ok Correct answer: answer = 7550

Test #16:

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

input:

50 100 50
37 79
7 50
40 90
24 69
27 75
25 70
46 99
9 54
19 62
35 78
8 51
11 60
21 67
30 75
11 57
4 50
10 55
40 92
45 97
41 95
27 73
25 71
38 80
11 57
30 75
24 68
2 49
11 56
20 64
40 92
9 53
35 77
3 49
39 83
37 80
20 67
1 48
36 79
31 76
38 81
21 68
26 71
0 48
27 75
9 53
13 61
27 74
14 62
39 84
3 49

output:

098d134608c94f7413faac591054ee35
7220

result:

ok Correct answer: answer = 7220

Test #17:

score: 4
Accepted
time: 2ms
memory: 9944kb

input:

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

output:

098d134608c94f7413faac591054ee35
7550

result:

ok Correct answer: answer = 7550

Test #18:

score: 4
Accepted
time: 2ms
memory: 10200kb

input:

50 100 50
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99

output:

098d134608c94f7413faac591054ee35
10000

result:

ok Correct answer: answer = 10000

Test #19:

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

input:

50 100 50
0 99
1 98
3 98
3 96
3 96
4 93
4 92
5 92
6 91
8 91
9 91
10 90
11 90
12 85
12 82
17 82
19 82
19 81
20 80
21 76
21 76
22 75
22 75
23 73
23 72
24 72
24 71
25 71
25 70
28 68
28 66
29 66
30 64
31 63
31 63
33 62
34 61
36 60
37 60
39 60
40 59
43 59
44 59
45 58
45 57
46 56
47 55
50 53
50 52
51 52

output:

098d134608c94f7413faac591054ee35
10000

result:

ok Correct answer: answer = 10000

Test #20:

score: 4
Accepted
time: 2ms
memory: 10000kb

input:

50 100 50
61 62
12 15
81 81
49 50
78 85
62 69
55 61
57 57
22 25
77 78
2 5
8 12
62 67
49 50
19 25
60 62
71 77
74 74
90 95
33 34
24 26
47 54
45 51
72 75
89 89
18 19
36 38
6 8
1 3
25 26
73 77
35 38
1 4
55 57
85 91
82 86
66 66
18 18
3 5
61 64
32 32
21 22
61 63
79 83
74 80
68 74
72 75
75 81
66 69
51 55

output:

098d134608c94f7413faac591054ee35
624

result:

ok Correct answer: answer = 624

Test #21:

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

input:

50 100 50
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99
0 99

output:

098d134608c94f7413faac591054ee35
10000

result:

ok Correct answer: answer = 10000

Test #22:

score: 4
Accepted
time: 2ms
memory: 10016kb

input:

1 1 1
0 0

output:

098d134608c94f7413faac591054ee35
1

result:

ok Correct answer: answer = 1

Subtask #2:

score: 0
Wrong Answer

Test #23:

score: 12
Accepted
time: 2ms
memory: 10200kb

input:

2 2 1
0 0
1 1

output:

098d134608c94f7413faac591054ee35
4

result:

ok Correct answer: answer = 4

Test #24:

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

input:

4 3 2
0 0
0 0
0 0
0 0

output:

098d134608c94f7413faac591054ee35
1

result:

ok Correct answer: answer = 1

Test #25:

score: 12
Accepted
time: 2ms
memory: 10224kb

input:

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

output:

098d134608c94f7413faac591054ee35
5

result:

ok Correct answer: answer = 5

Test #26:

score: 12
Accepted
time: 2ms
memory: 10216kb

input:

10 20 3
3 3
15 15
10 10
18 18
4 4
7 7
15 15
2 2
10 10
7 7

output:

098d134608c94f7413faac591054ee35
41

result:

ok Correct answer: answer = 41

Test #27:

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

input:

20 1000 5
737 737
714 714
662 662
163 163
683 683
615 615
23 23
246 246
724 724
90 90
802 802
557 557
146 146
429 429
816 816
164 164
638 638
568 568
957 957
904 904

output:

098d134608c94f7413faac591054ee35
71923

result:

ok Correct answer: answer = 71923

Test #28:

score: 12
Accepted
time: 2ms
memory: 10256kb

input:

200 1000 10
69 69
277 277
350 350
753 753
741 741
849 849
993 993
95 95
928 928
789 789
333 333
795 795
493 493
253 253
661 661
780 780
17 17
394 394
487 487
719 719
426 426
297 297
885 885
323 323
981 981
916 916
0 0
997 997
757 757
374 374
467 467
787 787
297 297
216 216
599 599
62 62
936 936
777 ...

output:

098d134608c94f7413faac591054ee35
77137

result:

ok Correct answer: answer = 77137

Test #29:

score: 0
Wrong Answer
time: 0ms
memory: 10104kb

input:

500 1000 250
599 599
14 14
176 176
963 963
93 93
257 257
403 403
741 741
854 854
862 862
778 778
489 489
711 711
623 623
163 163
750 750
649 649
441 441
245 245
311 311
429 429
756 756
572 572
766 766
837 837
137 137
719 719
244 244
519 519
287 287
251 251
818 818
789 789
305 305
400 400
262 262
359...

output:

098d134608c94f7413faac591054ee35
729

result:

wrong answer Wrong answer: output = 729, expected = 764

Subtask #3:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%

Subtask #5:

score: 19
Accepted

Dependency #1:

100%
Accepted

Test #112:

score: 19
Accepted
time: 135ms
memory: 30380kb

input:

50000 1000000 3
360946 187012
56354 290116
389944 194589
327798 454716
248464 891509
615396 878303
736802 689759
446833 816714
552228 948958
34870 257015
911026 191884
761150 821028
341778 82756
125288 719663
86132 290045
145161 627383
25381 217026
756213 671192
686079 478553
648300 785174
706912 93...

output:

098d134608c94f7413faac591054ee35
999889968863

result:

ok Correct answer: answer = 999889968863

Test #113:

score: 19
Accepted
time: 133ms
memory: 31252kb

input:

50000 1000000 8
399073 559474
284146 99898
375389 122686
80775 357801
319456 379430
251948 425589
470164 726942
180115 677331
174879 609886
879336 274639
172132 755286
73776 907221
655053 808794
127586 558652
158465 298754
474407 208895
819275 192292
754904 362313
942856 453040
205348 662961
554428 ...

output:

098d134608c94f7413faac591054ee35
999861384931

result:

ok Correct answer: answer = 999861384931

Test #114:

score: 19
Accepted
time: 132ms
memory: 30556kb

input:

50000 1000000 49
395775 225827
107876 226736
693613 305582
901641 53447
504609 994262
5047 608677
484540 120957
36722 397124
825085 736548
553505 750564
978962 460112
450110 15095
336393 250376
517875 417904
995371 271663
905045 858978
240324 844363
468528 106252
331737 99932
78429 675647
897302 755...

output:

098d134608c94f7413faac591054ee35
999811809929

result:

ok Correct answer: answer = 999811809929

Test #115:

score: 19
Accepted
time: 129ms
memory: 31736kb

input:

50000 1000000 99
595092 535757
193430 467573
548323 750849
89122 500291
562841 861078
924882 20121
116634 939464
735914 577485
455078 104026
434181 806496
208311 437995
721445 878386
306688 927173
567734 38513
58134 237797
539935 425782
797486 99058
692233 731520
455780 628428
543934 291599
230276 6...

output:

098d134608c94f7413faac591054ee35
999869756441

result:

ok Correct answer: answer = 999869756441

Test #116:

score: 19
Accepted
time: 35ms
memory: 14964kb

input:

50000 60000 2
8597 8597
9329 9329
9757 9757
52906 52906
3767 3767
1550 1550
27747 27747
32959 32959
51190 51190
11613 11613
5014 5014
2527 2527
14847 14847
23167 23167
35500 35500
53108 53108
37110 37110
56602 56602
39663 39663
4674 4674
37075 37075
7077 7077
24718 24718
17596 17596
8332 8332
15727 ...

output:

098d134608c94f7413faac591054ee35
1700000000

result:

ok Correct answer: answer = 1700000000

Test #117:

score: 19
Accepted
time: 35ms
memory: 16704kb

input:

50000 60000 19
8597 8597
9329 9329
9757 9757
52906 52906
3767 3767
1550 1550
27747 27747
32959 32959
51190 51190
11613 11613
5014 5014
2527 2527
14847 14847
23167 23167
35500 35500
53108 53108
37110 37110
56602 56602
39663 39663
4674 4674
37075 37075
7077 7077
24718 24718
17596 17596
8332 8332
15727...

output:

098d134608c94f7413faac591054ee35
131666670

result:

ok Correct answer: answer = 131666670

Test #118:

score: 19
Accepted
time: 7ms
memory: 11160kb

input:

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

output:

098d134608c94f7413faac591054ee35
89478486

result:

ok Correct answer: answer = 89478486

Test #119:

score: 19
Accepted
time: 9ms
memory: 11180kb

input:

16384 16384 54
8597 8597
9329 9329
9757 9757
15195 15195
3767 3767
1550 1550
10362 10362
3874 3874
11839 11839
11613 11613
5014 5014
2527 2527
14847 14847
6440 6440
3808 3808
5101 5101
16001 16001
1820 1820
342 342
4674 4674
10841 10841
7077 7077
7655 7655
8421 8421
8332 8332
15727 15727
16014 16014...

output:

098d134608c94f7413faac591054ee35
4971040

result:

ok Correct answer: answer = 4971040

Test #120:

score: 19
Accepted
time: 14ms
memory: 11144kb

input:

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

output:

098d134608c94f7413faac591054ee35
2711494

result:

ok Correct answer: answer = 2711494

Test #121:

score: 19
Accepted
time: 39ms
memory: 14756kb

input:

50000 50000 99
8597 8597
9329 9329
9757 9757
42906 42906
3767 3767
1550 1550
27747 27747
32959 32959
41190 41190
11613 11613
5014 5014
2527 2527
14847 14847
23167 23167
35500 35500
43108 43108
37110 37110
46602 46602
39663 39663
4674 4674
37075 37075
7077 7077
24718 24718
17596 17596
8332 8332
15727...

output:

098d134608c94f7413faac591054ee35
25252530

result:

ok Correct answer: answer = 25252530

Test #122:

score: 19
Accepted
time: 35ms
memory: 14368kb

input:

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

output:

098d134608c94f7413faac591054ee35
62500000

result:

ok Correct answer: answer = 62500000

Test #123:

score: 19
Accepted
time: 123ms
memory: 57724kb

input:

50000 1000000 3
360946 360946
56354 56354
389944 389944
327798 327798
248464 248464
615396 615396
736802 736802
446833 446833
552228 552228
34870 34870
911026 911026
761150 761150
341778 341778
125288 125288
86132 86132
145161 145161
25381 25381
756213 756213
686079 686079
648300 648300
706912 70691...

output:

098d134608c94f7413faac591054ee35
333175097780

result:

ok Correct answer: answer = 333175097780

Test #124:

score: 19
Accepted
time: 119ms
memory: 57948kb

input:

50000 1000000 30
868583 868583
205921 205921
293638 293638
718230 718230
689475 689475
939956 939956
705065 705065
606617 606617
127687 127687
964402 964402
840633 840633
706213 706213
104224 104224
254185 254185
857950 857950
467030 467030
414531 414531
674066 674066
475454 475454
115351 115351
444...

output:

098d134608c94f7413faac591054ee35
33121180179

result:

ok Correct answer: answer = 33121180179

Test #125:

score: 19
Accepted
time: 119ms
memory: 58364kb

input:

50000 1000000 100
499686 499686
920950 920950
68020 68020
204471 204471
319251 319251
809056 809056
996479 996479
713675 713675
722028 722028
240011 240011
158904 158904
485476 485476
707144 707144
120905 120905
810974 810974
903533 903533
599638 599638
601032 601032
9385 9385
952009 952009
177442 1...

output:

098d134608c94f7413faac591054ee35
9802314015

result:

ok Correct answer: answer = 9802314015

Test #126:

score: 19
Accepted
time: 38ms
memory: 16496kb

input:

50000 50001 77
8597 8598
9329 9330
9757 9758
42906 42907
3767 3768
1550 1551
27747 27748
32959 32960
41190 41191
11613 11614
5014 5015
2527 2528
14847 14848
23167 23168
35500 35501
43108 43109
37110 37111
46602 46603
39663 39664
4674 4675
37075 37076
7077 7078
24718 24719
17596 17597
8332 8333
15727...

output:

098d134608c94f7413faac591054ee35
32567551

result:

ok Correct answer: answer = 32567551

Test #127:

score: 19
Accepted
time: 76ms
memory: 21000kb

input:

50000 1000000 100
8597 958597
9329 959329
9757 959757
42906 992906
3767 953767
1550 951550
27747 977747
32959 982959
41190 991190
11613 961613
5014 955014
2527 952527
14847 964847
23167 973167
35500 985500
43108 993108
37110 987110
46602 996602
39663 989663
4674 954674
37075 987075
7077 957077
24718...

output:

098d134608c94f7413faac591054ee35
997525000000

result:

ok Correct answer: answer = 997525000000

Test #128:

score: 19
Accepted
time: 162ms
memory: 45304kb

input:

50000 1000000 100
86045 584554
93380 592108
97784 596480
428989 929562
37434 537369
15182 514700
276132 776637
329078 829920
412209 912707
115860 615414
50700 549519
25175 524476
148216 648347
230728 731655
354560 854985
430937 931632
371293 871039
465709 966648
397268 897510
46620 546353
371011 870...

output:

098d134608c94f7413faac591054ee35
752723538884

result:

ok Correct answer: answer = 752723538884

Test #129:

score: 19
Accepted
time: 73ms
memory: 15732kb

input:

50000 1000000 2
0 999999
1 999998
2 999997
3 999996
4 999995
5 999994
6 999993
7 999992
8 999991
9 999990
10 999989
11 999988
12 999987
13 999986
14 999985
15 999984
16 999983
17 999982
18 999981
19 999980
20 999979
21 999978
22 999977
23 999976
24 999975
25 999974
26 999973
27 999972
28 999971
29 9...

output:

098d134608c94f7413faac591054ee35
1000000000000

result:

ok Correct answer: answer = 1000000000000

Test #130:

score: 19
Accepted
time: 135ms
memory: 30884kb

input:

50000 1000000 100
87767 914575
95442 907328
99268 903006
431714 574333
37647 962807
15328 984999
279716 725766
332459 673480
414173 591754
117465 884601
51031 950747
25233 975412
150032 852999
234175 771181
358003 648070
433772 572367
373924 631925
468696 537236
398823 606636
47251 954017
373693 632...

output:

098d134608c94f7413faac591054ee35
999978000121

result:

ok Correct answer: answer = 999978000121

Test #131:

score: 19
Accepted
time: 124ms
memory: 31600kb

input:

50000 1000000 100
481134 538918
179952 570040
128320 416190
312918 555628
131195 364902
21377 38144
221008 432927
359478 788822
261635 323643
30206 438983
381283 734341
301696 492296
377432 634178
396957 512723
112085 560896
428742 685042
328292 679458
195478 417480
442233 705405
407510 676169
17236...

output:

098d134608c94f7413faac591054ee35
745986144735

result:

ok Correct answer: answer = 745986144735

Test #132:

score: 19
Accepted
time: 9ms
memory: 14880kb

input:

50000 1000000 2
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
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:

098d134608c94f7413faac591054ee35
2

result:

ok Correct answer: answer = 2

Test #133:

score: 19
Accepted
time: 45ms
memory: 19884kb

input:

50000 1000000 10
8597 8599
9329 9331
9757 9759
42906 42908
3767 3769
1550 1552
27747 27749
32959 32961
41190 41192
11613 11615
5014 5016
2527 2529
14847 14849
23167 23169
35500 35502
43108 43110
37110 37112
46602 46604
39663 39665
4674 4676
37075 37077
7077 7079
24718 24720
17596 17598
8332 8334
157...

output:

098d134608c94f7413faac591054ee35
277966670

result:

ok Correct answer: answer = 277966670

Test #134:

score: 19
Accepted
time: 39ms
memory: 19724kb

input:

50000 1000000 2
8597 8607
9329 9339
9757 9767
42906 42916
3767 3777
1550 1560
27747 27757
32959 32969
41190 41200
11613 11623
5014 5024
2527 2537
14847 14857
23167 23177
35500 35510
43108 43118
37110 37120
46602 46612
39663 39673
4674 4684
37075 37085
7077 7087
24718 24728
17596 17606
8332 8342
1572...

output:

098d134608c94f7413faac591054ee35
2500900082

result:

ok Correct answer: answer = 2500900082

Test #135:

score: 19
Accepted
time: 71ms
memory: 22884kb

input:

50000 1000000 2
508597 8662
509329 9409
509757 9781
542906 42991
503767 3812
501550 1589
527747 27841
532959 33013
541190 41274
511613 11664
505014 5086
502527 2552
514847 14939
523167 23170
535500 35591
543108 43186
537110 37159
546602 46604
539663 39751
504674 4758
537075 37104
507077 7163
524718 ...

output:

098d134608c94f7413faac591054ee35
301248349636

result:

ok Correct answer: answer = 301248349636

Test #136:

score: 19
Accepted
time: 34ms
memory: 12456kb

input:

25000 37576 100
12856 12857
13975 13976
14631 14632
34568 34569
5631 5632
2332 2333
15541 15542
35940 35941
26888 26889
17411 17412
7508 7509
3790 3791
22239 22240
34813 34814
5695 5696
7642 7643
29573 29574
2733 2734
511 512
6997 6998
16255 16256
10602 10603
37158 37159
26390 26391
12449 12450
2357...

output:

098d134608c94f7413faac591054ee35
14118891

result:

ok Correct answer: answer = 14118891

Test #137:

score: 19
Accepted
time: 74ms
memory: 18932kb

input:

50000 1000000 3
390734 398220
397878 389464
372115 364372
73360 2106
377730 395883
386584 398937
46820 21049
349326 346916
55669 13876
14962 75840
349395 371413
368255 369385
83467 61749
358082 351311
354683 358458
361515 365082
104716 93892
20127 90890
42717 80295
23383 72371
359895 353818
71221 29...

output:

098d134608c94f7413faac591054ee35
14384977265

result:

ok Correct answer: answer = 14384977265

Test #138:

score: 19
Accepted
time: 86ms
memory: 28736kb

input:

50000 1000000 50
977840 980140
602467 603812
192626 192338
160785 157069
345895 346132
17947 16934
978577 981103
234945 234558
829369 815158
295364 301821
305418 309473
587646 587539
976222 981151
350890 348731
16757 16760
195837 194714
236450 236937
68828 66037
298706 297316
525213 525019
530034 53...

output:

098d134608c94f7413faac591054ee35
3681368330

result:

ok Correct answer: answer = 3681368330

Test #139:

score: 19
Accepted
time: 94ms
memory: 30224kb

input:

50000 1000000 100
965009 964973
295451 294318
648689 651962
44200 44235
714566 715211
592904 591297
559360 558935
657109 657288
936305 936630
123590 122938
124466 124338
269122 265590
562679 558565
712091 710652
6175 7111
49971 53980
66132 70186
22159 21506
700150 701579
766381 766230
790385 787771
...

output:

098d134608c94f7413faac591054ee35
2720316816

result:

ok Correct answer: answer = 2720316816

Subtask #6:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%