QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#127203#3153. JOI ParkKKT89100 ✓104ms22912kbC++141.8kb2023-07-19 14:03:562023-07-19 14:03:59

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-19 14:03:59]
  • 评测
  • 测评结果:100
  • 用时:104ms
  • 内存:22912kb
  • [2023-07-19 14:03:56]
  • 提交

answer

#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
using namespace std;
typedef long long int ll;

struct Edge{
	int to; ll dist;
	Edge(){}
	Edge(int to,ll dist):to(to),dist(dist){}
};

template <class E>
using Graph = vector<vector<E>>;
 
template<class D, D INF>
struct Dijkstra {
    vector<D> res; //res[i] = sからiまでの最短距離
    
    template<class E>
    Dijkstra(const Graph<E> &g, int s) {
        int V = (int)g.size();
        res = vector<D>(V, INF);
        
        using P = pair<D, int>;
        priority_queue<P, vector<P>, greater<P>> q;
        q.push(P(0, s));
        res[s] = 0;
        while (!q.empty()) {
            P p = q.top(); q.pop();
            if (res[p.second] < p.first) continue;
            for (E e: g[p.second]) {
                if (p.first+e.dist < res[e.to]) {
                    res[e.to] = p.first+e.dist;
                    q.push(P(res[e.to], e.to));
                }
            }
        }
    }
};
int a[200100],b[200100],d[200100];
ll sum[100100];

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n,m; cin >> n >> m;
	Graph<Edge> g(n);
	ll c; cin >> c;
	for(int i=0;i<m;i++){
		cin >> a[i] >> b[i] >> d[i];
		a[i]--; b[i]--;
		g[a[i]].push_back(Edge(b[i],d[i]));
		g[b[i]].push_back(Edge(a[i],d[i]));
	}
	Dijkstra<ll,(ll)1e15> di(g,0);
	for(int i=0;i<m;i++){
		if(di.res[a[i]]<di.res[b[i]])sum[b[i]]+=d[i];
		else sum[a[i]]+=d[i];
	}
	vector<pair<ll,int>> v;
	for(int i=0;i<n;i++){
		v.push_back({di.res[i],i});
	}
	sort(v.rbegin(),v.rend());
	ll ans=1e15;
	ll cnt=0;
	for(int i=0;i<n;i++){
		ans=min(ans,cnt+v[i].first*c);
		cnt+=sum[v[i].second];
	}
	ans=min(ans,cnt);
	cout << ans << endl;
}


詳細信息

Subtask #1:

score: 15
Accepted

Test #1:

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

input:

2 1 66
2 1 7

output:

7

result:

ok single line: '7'

Test #2:

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

input:

5 10 23
5 2 8
4 2 10
4 5 3
5 3 7
1 5 4
1 4 1
3 2 4
1 2 4
3 4 10
1 3 6

output:

57

result:

ok single line: '57'

Test #3:

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

input:

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

output:

108

result:

ok single line: '108'

Test #4:

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

input:

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

output:

44

result:

ok single line: '44'

Test #5:

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

input:

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

output:

252

result:

ok single line: '252'

Test #6:

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

input:

70 141 52
66 38 3
30 39 6
65 10 2
4 48 8
70 40 8
43 46 8
17 13 5
21 26 5
24 40 3
24 27 3
59 1 1
29 49 2
49 23 8
45 44 3
9 5 7
63 56 2
23 30 8
35 50 7
42 26 3
68 50 4
69 40 1
40 63 7
19 67 6
70 39 4
41 46 6
39 24 5
65 67 3
57 9 7
56 17 2
56 10 9
33 32 2
62 20 5
36 26 4
55 26 2
10 64 5
11 62 9
53 67 8...

output:

732

result:

ok single line: '732'

Test #7:

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

input:

100 99 92
45 1 6
1 44 9
43 1 1
1 100 2
87 1 3
1 75 6
90 1 10
15 1 1
86 1 10
79 1 3
27 1 2
88 1 10
59 1 5
38 1 4
83 1 1
68 1 5
1 5 10
49 1 4
95 1 9
1 3 3
1 17 9
76 1 9
13 1 2
60 1 1
52 1 5
14 1 1
1 11 9
1 64 5
1 81 5
1 65 7
19 1 1
18 1 2
96 1 9
82 1 1
37 1 5
23 1 4
1 25 10
71 1 6
1 99 8
1 92 9
80 1 8...

output:

538

result:

ok single line: '538'

Test #8:

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

input:

100 99 4
92 1 1
1 18 1
1 71 1
1 15 1
48 1 1
49 1 1
37 1 1
88 1 1
1 77 1
1 74 1
1 39 1
5 1 1
57 1 1
43 1 1
3 1 1
1 95 1
1 100 1
62 1 1
65 1 1
1 55 1
1 25 1
1 58 1
20 1 1
1 28 1
93 1 1
1 12 1
1 90 1
19 1 1
1 17 1
83 1 1
29 1 1
10 1 1
1 31 1
1 33 1
41 1 1
1 69 1
1 80 1
1 46 1
81 1 1
64 1 1
1 98 1
76 1 ...

output:

4

result:

ok single line: '4'

Test #9:

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

input:

100 99 48
38 37 6
28 27 5
68 67 10
99 100 6
15 14 1
35 34 6
2 1 6
96 95 9
37 36 9
75 74 1
91 90 6
30 29 7
54 53 10
65 66 3
87 86 3
5 4 10
70 69 4
3 4 1
40 39 1
8 7 2
61 62 4
50 51 4
96 97 2
33 34 10
32 33 2
51 52 2
31 30 9
43 44 8
82 83 1
25 24 5
21 22 4
94 95 7
80 81 9
25 26 9
12 11 9
85 86 9
67 66...

output:

544

result:

ok single line: '544'

Test #10:

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

input:

100 200 100
88 18 10
57 7 10
27 66 10
41 83 10
90 28 10
92 6 10
84 47 10
94 9 10
80 81 10
15 75 10
6 85 10
93 49 10
99 48 10
17 58 10
22 68 10
44 16 10
1 87 10
55 67 10
65 6 10
40 61 10
43 60 10
65 44 10
77 38 10
49 96 10
30 71 10
78 76 10
28 32 10
87 16 10
60 75 10
81 50 10
92 19 10
48 60 10
94 20 ...

output:

2000

result:

ok single line: '2000'

Test #11:

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

input:

100 110 100
62 12 1
50 92 1
100 90 1
29 91 1
67 14 1
6 5 1
25 68 1
69 41 1
4 81 1
5 98 1
48 10 1
39 36 1
58 33 1
14 89 1
13 56 1
89 8 1
14 54 1
40 17 1
55 79 1
57 61 1
73 54 1
55 54 1
64 14 1
97 2 1
17 14 1
25 67 1
15 75 1
57 73 1
33 45 1
50 16 1
53 59 1
97 19 1
53 90 1
20 18 1
84 52 1
6 9 1
57 53 1...

output:

110

result:

ok single line: '110'

Test #12:

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

input:

100 200 1
59 92 10
95 92 10
7 80 10
41 22 10
4 31 10
14 20 10
28 74 10
3 35 10
19 23 10
93 41 10
21 6 10
46 58 10
85 63 10
54 11 10
18 81 10
66 90 10
8 5 10
18 64 10
81 71 10
59 84 10
7 48 10
34 83 10
32 69 10
67 2 10
13 14 10
15 66 10
9 55 10
87 82 10
20 59 10
50 90 10
8 16 10
68 23 10
79 83 10
64 ...

output:

60

result:

ok single line: '60'

Test #13:

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

input:

100 200 68
69 81 1
34 57 1
95 44 1
4 42 1
30 14 1
47 68 1
90 97 1
85 4 1
16 62 1
56 45 1
37 12 1
30 16 1
28 55 1
17 19 1
86 24 1
64 79 1
44 98 1
87 24 1
61 90 1
100 41 1
88 78 1
70 21 1
3 16 1
81 71 1
92 58 1
18 75 1
92 62 1
3 20 1
24 5 1
52 83 1
37 16 1
55 18 1
86 18 1
99 87 1
14 16 1
23 15 1
66 31...

output:

200

result:

ok single line: '200'

Test #14:

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

input:

100 200 27
83 14 1
80 100 1
76 30 1
78 19 2
10 60 2
87 97 1
50 69 1
24 12 2
32 71 2
2 52 1
38 6 2
75 93 2
21 41 2
70 2 2
53 43 1
34 53 1
59 7 2
22 62 1
75 2 2
52 31 1
66 71 1
20 43 2
83 56 1
8 21 1
71 79 1
24 45 1
77 7 1
51 52 1
88 15 2
36 82 1
65 75 2
66 4 1
15 14 1
75 55 1
29 92 1
96 64 2
9 88 2
8...

output:

194

result:

ok single line: '194'

Test #15:

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

input:

100 200 48
12 23 7
72 32 5
34 1 4
36 67 4
25 34 4
41 11 2
34 6 1
84 75 9
74 86 7
61 2 1
10 22 8
21 15 1
20 66 5
1 95 3
53 43 1
57 59 6
52 60 6
31 33 4
2 17 4
89 5 3
30 39 5
66 53 9
64 89 3
57 79 6
45 91 1
40 67 10
60 96 9
39 45 7
29 77 2
42 68 9
6 4 8
60 41 7
28 43 4
70 100 9
37 76 5
96 16 2
10 46 1...

output:

941

result:

ok single line: '941'

Test #16:

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

input:

100 200 34
95 69 7
41 29 10
80 33 4
69 83 8
79 73 1
36 10 7
65 70 5
38 67 5
9 25 1
71 38 6
55 11 7
33 3 9
27 96 10
3 5 2
19 54 7
97 57 5
89 45 4
8 3 3
86 73 10
47 82 9
64 55 6
28 7 10
20 64 7
62 75 4
52 87 9
48 18 9
74 25 4
68 40 3
82 40 2
19 42 4
76 6 6
97 34 4
35 22 3
18 25 8
52 75 7
65 76 8
41 79...

output:

847

result:

ok single line: '847'

Test #17:

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

input:

100 200 100
50 74 8
62 81 6
77 96 1
75 80 5
29 93 10
48 22 5
10 17 9
64 56 2
76 85 4
78 96 9
65 72 7
8 73 1
24 9 3
95 20 5
35 34 7
64 37 8
25 86 7
22 23 1
19 37 3
62 26 10
33 70 2
20 65 4
26 61 7
3 83 9
14 18 7
59 6 7
69 47 4
18 27 2
82 97 8
35 64 2
89 92 9
84 18 1
36 72 3
81 19 8
58 46 6
65 87 10
1...

output:

1093

result:

ok single line: '1093'

Test #18:

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

input:

100 200 100
7 11 3
54 29 2
65 1 9
91 48 4
8 79 10
2 43 10
86 72 8
18 40 7
74 35 2
28 64 7
30 11 7
60 93 6
80 15 8
43 29 7
45 27 3
98 99 6
9 50 10
84 49 2
12 37 5
93 17 10
21 93 5
70 48 7
18 65 4
38 53 1
21 61 10
59 36 4
87 17 10
77 19 10
3 16 5
75 71 2
90 60 10
78 79 3
8 41 2
8 60 1
57 44 10
49 93 6...

output:

1160

result:

ok single line: '1160'

Subtask #2:

score: 45
Accepted

Dependency #1:

100%
Accepted

Test #19:

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

input:

54 61 20983
10 42 87903
22 14 11822
5 53 57569
13 27 29736
32 50 14462
10 11 40714
51 10 25235
16 27 20546
29 51 88212
44 23 40619
2 50 7571
42 9 82705
27 39 20182
2 3 61654
4 22 52371
38 53 91934
21 31 87689
28 20 52885
42 7 61075
53 24 26219
36 26 80119
34 22 62246
33 2 51534
35 46 40168
33 22 277...

output:

3229622

result:

ok single line: '3229622'

Test #20:

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

input:

25 135 19901
6 21 32227
23 2 50668
6 3 80864
19 13 46002
1 8 77201
9 12 29907
15 7 58009
19 22 84538
7 14 41515
1 20 8798
23 20 87951
14 2 36540
7 5 6816
22 1 81240
25 4 26990
24 4 71168
21 9 15069
15 1 50671
18 23 28534
22 9 7424
5 6 26060
5 11 21907
12 5 39344
19 15 18030
18 15 86523
8 11 82605
11...

output:

6385345

result:

ok single line: '6385345'

Test #21:

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

input:

45 378 56926
5 7 19165
28 27 16763
22 3 33112
45 29 7473
6 31 92041
33 22 65360
20 25 61647
24 20 93088
6 45 35343
4 2 35158
4 11 8059
18 38 36829
6 14 46529
44 42 42034
26 25 85998
13 9 5792
15 24 51233
5 1 10786
12 23 78740
2 36 28816
43 24 82899
34 33 94258
2 12 84025
23 34 47426
5 37 86363
14 32...

output:

18505392

result:

ok single line: '18505392'

Test #22:

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

input:

81 2856 56400
12 16 3719
15 12 68452
41 66 16373
31 51 828
33 72 47164
51 70 95070
29 2 12100
61 19 70219
25 33 77227
36 47 33817
23 42 29000
60 79 56657
67 7 99428
74 28 1626
44 68 30966
53 23 26875
24 81 93803
3 11 27469
67 22 20856
49 47 56234
2 63 83155
79 20 88182
3 2 18514
58 45 12392
55 76 59...

output:

143924815

result:

ok single line: '143924815'

Test #23:

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

input:

100 99 45413
1 91 25753
1 64 23159
1 20 21107
1 42 72122
76 1 73086
10 1 24470
1 22 49610
34 1 2570
51 1 81020
1 80 18215
1 11 26416
1 63 96564
1 15 3525
1 23 50288
1 31 34674
40 1 1741
25 1 55012
8 1 12391
1 60 48685
97 1 28991
28 1 8208
61 1 82426
85 1 65348
78 1 55177
1 27 16464
1 55 14723
1 47 9...

output:

4775186

result:

ok single line: '4775186'

Test #24:

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

input:

100 99 93311
63 1 1
98 1 1
27 1 1
1 6 1
11 1 1
76 1 1
1 9 1
1 51 1
1 71 1
5 1 1
1 16 1
1 75 1
57 1 1
67 1 1
69 1 1
68 1 1
1 37 1
43 1 1
1 88 1
32 1 1
1 70 1
1 39 1
1 80 1
89 1 1
85 1 1
22 1 1
1 33 1
53 1 1
58 1 1
78 1 1
94 1 1
1 90 1
62 1 1
1 79 1
82 1 1
23 1 1
4 1 1
17 1 1
1 96 1
66 1 1
59 1 1
60 1...

output:

99

result:

ok single line: '99'

Test #25:

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

input:

100 99 32557
82 83 34990
85 84 63360
28 27 98736
43 44 29906
81 80 38580
2 1 74081
11 10 89210
38 37 58945
42 43 18744
91 92 84789
54 53 85624
59 58 13977
36 35 72887
87 86 6128
90 91 35359
4 3 79205
33 32 59720
26 27 74353
50 51 14406
81 82 75778
55 56 43880
9 10 26810
73 74 55554
70 69 10811
30 31...

output:

4876849

result:

ok single line: '4876849'

Test #26:

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

input:

100 4000 100000
58 87 100000
96 24 100000
41 73 100000
80 63 100000
49 1 100000
48 66 100000
36 31 100000
25 62 100000
84 31 100000
73 37 100000
39 19 100000
89 41 100000
17 47 100000
30 25 100000
44 86 100000
6 67 100000
20 47 100000
87 7 100000
39 9 100000
59 42 100000
61 62 100000
24 34 100000
59...

output:

400000000

result:

ok single line: '400000000'

Test #27:

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

input:

100 4000 100000
41 10 1
28 10 1
70 23 1
19 80 1
18 98 1
36 82 1
76 56 1
84 46 1
35 67 1
55 57 1
81 90 1
97 62 1
51 47 1
63 73 1
3 96 1
32 22 1
79 19 1
55 67 1
46 1 1
80 7 1
64 100 1
44 5 1
1 38 1
17 80 1
10 15 1
50 84 1
74 35 1
91 49 1
62 98 1
15 33 1
17 31 1
50 85 1
63 26 1
70 39 1
73 23 1
1 66 1
4...

output:

4000

result:

ok single line: '4000'

Test #28:

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

input:

100 4000 1
14 88 100000
17 49 100000
89 9 100000
20 8 100000
90 50 100000
7 36 100000
58 25 100000
61 63 100000
8 65 100000
64 22 100000
95 27 100000
50 7 100000
8 92 100000
49 96 100000
71 57 100000
4 40 100000
40 86 100000
59 10 100000
53 94 100000
24 23 100000
29 14 100000
10 82 100000
42 4 10000...

output:

200000

result:

ok single line: '200000'

Test #29:

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

input:

100 99 100000
81 80 100000
13 12 100000
62 61 100000
15 16 100000
26 27 100000
25 26 100000
90 89 100000
74 73 100000
81 82 100000
49 50 100000
15 14 100000
30 31 100000
60 59 100000
8 7 100000
1 2 100000
95 96 100000
57 56 100000
91 90 100000
22 23 100000
97 96 100000
82 83 100000
21 20 100000
5 6 ...

output:

9900000

result:

ok single line: '9900000'

Test #30:

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

input:

100 200 32549
66 4 67267
73 90 97867
71 82 97576
65 12 79277
50 100 98963
68 100 95858
30 11 30439
92 83 55354
72 81 27461
12 57 97796
84 81 84384
62 52 34900
74 29 20032
25 5 55919
99 75 25872
67 20 6854
92 34 6711
9 38 52731
75 51 10134
57 91 6166
7 82 81744
69 47 53822
36 29 93677
74 41 39303
95 ...

output:

10416446

result:

ok single line: '10416446'

Test #31:

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

input:

100 1000 93156
70 72 782
36 26 5803
11 48 53356
54 23 74952
30 1 17136
100 33 3479
79 82 64070
42 99 67209
20 96 98628
60 12 99117
92 49 96148
90 10 71460
94 83 8652
97 70 62432
68 55 66088
41 72 37106
1 18 63413
18 24 88876
99 100 28366
43 58 61963
16 13 45912
6 68 47795
65 35 2733
21 55 61518
32 9...

output:

50692533

result:

ok single line: '50692533'

Test #32:

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

input:

100 4000 29871
4 16 96950
37 8 62906
76 84 79576
31 3 69443
83 61 29930
64 47 55839
88 90 50710
97 76 42763
73 28 45915
26 98 3139
5 2 53078
54 72 92666
54 100 21045
84 18 33241
42 10 77320
44 30 10370
50 35 60750
20 58 87637
52 76 79655
60 7 18926
28 62 70744
66 91 1982
63 87 29793
97 71 93626
56 5...

output:

198492768

result:

ok single line: '198492768'

Test #33:

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

input:

100 200 22387
93 17 42031
68 87 1814
19 3 56090
96 3 91212
90 52 64375
92 5 7699
98 41 86685
45 80 38169
37 6 96989
96 89 47012
27 38 2138
37 44 2999
1 7 12241
47 27 4825
88 5 51600
58 40 7905
14 36 13901
42 32 50793
18 79 95652
83 67 2149
39 65 59032
32 38 45618
92 61 77056
31 2 14566
25 94 65279
8...

output:

9783111

result:

ok single line: '9783111'

Test #34:

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

input:

100 500 82152
94 10 90123
71 8 57442
34 20 17808
7 40 86206
6 33 31255
19 77 76685
35 78 36644
76 67 58835
34 66 78725
28 65 28260
78 3 56733
72 73 79181
69 34 21898
84 23 47077
94 99 42008
50 53 81933
100 36 29829
55 75 99078
82 79 6412
27 85 69287
66 51 8535
83 36 91284
53 46 42412
23 41 48875
60 ...

output:

25446001

result:

ok single line: '25446001'

Test #35:

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

input:

100 1000 14125
47 20 28184
64 79 61506
92 7 72816
49 29 55503
43 14 26142
12 73 31217
64 62 53322
3 43 1858
88 46 33668
66 30 55786
94 8 20109
17 65 95075
93 76 27308
79 54 54262
37 45 32497
74 35 3294
71 29 99223
84 13 79450
49 67 49193
86 1 91071
48 49 56496
27 66 28361
94 76 7940
18 71 98877
59 9...

output:

50279654

result:

ok single line: '50279654'

Test #36:

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

input:

100 4000 43
87 15 45068
59 21 22116
46 27 41776
82 89 44788
97 58 31942
20 26 13368
13 76 77964
84 7 59055
89 92 10225
32 73 3589
63 37 78855
60 35 86671
4 65 47090
38 3 13031
75 30 92212
76 66 52898
90 28 28361
53 32 65099
38 62 6563
46 60 55990
59 55 33225
54 79 90118
9 83 17645
82 86 21997
57 8 6...

output:

550056

result:

ok single line: '550056'

Test #37:

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

input:

100 4000 100000
35 72 80269
80 26 44295
32 96 65730
9 45 24904
41 78 56539
29 97 50152
78 53 74682
29 77 96162
41 16 19945
17 20 56526
99 51 64493
25 73 11793
17 43 14394
56 99 38194
42 88 53143
64 70 28739
33 37 36703
67 22 6098
16 78 76498
5 29 96666
38 88 91258
38 58 10047
26 77 17496
70 39 1324
...

output:

199178872

result:

ok single line: '199178872'

Subtask #3:

score: 40
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #38:

score: 40
Accepted
time: 71ms
memory: 19064kb

input:

76410 147876 26905
23617 40781 41521
13084 72767 98397
17883 33710 36280
68711 67492 11426
37462 50568 26676
16466 23235 5138
7385 50425 69300
50053 25622 65221
59387 64935 66704
55851 34481 33070
14020 8625 57198
17476 30637 42976
53595 74353 74321
23283 48444 47957
46010 52810 18069
45435 6878 979...

output:

7396383247

result:

ok single line: '7396383247'

Test #39:

score: 0
Accepted
time: 96ms
memory: 22068kb

input:

94146 194225 32613
27207 1045 60857
93326 42980 7807
83884 14796 49337
28283 54342 46003
21483 45500 45018
7716 33036 20058
57902 7601 52903
10090 80160 96671
89083 43704 87734
81558 40351 97411
13421 38898 92119
58797 50557 909
47558 42423 41560
13708 82455 75325
88958 80141 1412
64626 47714 39985
...

output:

9705231176

result:

ok single line: '9705231176'

Test #40:

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

input:

34675 37789 3530
3414 34282 85817
16360 19725 11434
27286 537 74805
21437 22494 5430
12392 3439 11560
3849 8568 52069
1975 16685 56026
32189 7325 22204
25345 34455 93693
530 6163 90584
19248 3791 59087
930 5884 66294
29259 13503 37158
33842 3240 31307
19403 9741 76815
32836 15971 10691
10514 21826 1...

output:

1882061382

result:

ok single line: '1882061382'

Test #41:

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

input:

37958 189698 37468
20281 19435 82532
15250 32219 63246
8324 1010 54755
16167 32295 66185
18089 20135 6864
35089 29213 21615
22592 31737 48863
9349 27971 31311
36728 29870 38725
25229 17866 14231
5782 15107 18449
26764 16370 34725
11219 32699 56042
22415 3509 59135
23665 18617 42480
9704 31117 25937
...

output:

5565123120

result:

ok single line: '5565123120'

Test #42:

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

input:

100000 99999 52979
58043 1 80813
1 65889 91786
1 9751 71893
1 73616 74287
1 15986 16030
1 24277 86340
1 76982 15476
7318 1 79260
1 20746 44164
1 13016 94949
1 45964 70835
7519 1 4754
13077 1 90246
1 15891 47480
1 14892 41309
65405 1 4665
1 29484 15550
1 93799 63275
42885 1 96945
22285 1 30893
20198 ...

output:

5001553268

result:

ok single line: '5001553268'

Test #43:

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

input:

100000 99999 155
6003 1 1
1 23202 1
1 25172 1
29501 1 1
55293 1 1
1 93464 1
12761 1 1
66158 1 1
1 93083 1
55184 1 1
4324 1 1
1 96057 1
1 20452 1
1 13172 1
37614 1 1
88203 1 1
2207 1 1
62481 1 1
1 27032 1
45444 1 1
42697 1 1
1 89383 1
1 90914 1
1 82389 1
1 57300 1
13882 1 1
78141 1 1
1 51721 1
1 4974...

output:

155

result:

ok single line: '155'

Test #44:

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

input:

100000 99999 64505
31462 31461 80330
46769 46768 79926
25148 25149 2065
16955 16956 22952
26212 26213 69231
7089 7088 22060
57879 57880 95051
98301 98302 95062
31593 31592 7152
93237 93238 18813
55905 55904 48801
27614 27613 12258
46828 46829 46520
19236 19235 63556
92648 92647 45679
49870 49871 369...

output:

4986405460

result:

ok single line: '4986405460'

Test #45:

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

input:

100000 99999 100000
49823 49824 100000
97262 97263 100000
87001 87002 100000
21140 21139 100000
87066 87067 100000
82747 82748 100000
77222 77223 100000
88299 88298 100000
38025 38026 100000
70818 70819 100000
51600 51599 100000
95698 95699 100000
36983 36984 100000
44026 44027 100000
98476 98477 10...

output:

9999900000

result:

ok single line: '9999900000'

Test #46:

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

input:

100000 200000 100000
45980 6795 100000
23412 50142 100000
83779 85861 100000
89899 89139 100000
69933 73362 100000
60866 22369 100000
67906 97215 100000
53010 89231 100000
97752 88146 100000
72773 37122 100000
43760 8694 100000
16597 99075 100000
42760 73599 100000
62620 72680 100000
38559 52491 100...

output:

20000000000

result:

ok single line: '20000000000'

Test #47:

score: 0
Accepted
time: 47ms
memory: 16028kb

input:

100000 100000 100000
83588 4765 1
64151 5323 1
13452 60525 1
53178 4220 1
66887 89228 1
87498 55891 1
7543 61254 1
38616 86581 1
93130 23062 1
47619 72970 1
33703 98687 1
42998 59171 1
98308 6538 1
23530 88703 1
75164 4731 1
28365 61633 1
16717 15666 1
40395 26919 1
53194 99987 1
48091 29131 1
85409...

output:

100000

result:

ok single line: '100000'

Test #48:

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

input:

100000 200000 1
65297 98935 100000
28628 83175 100000
94301 75185 100000
72654 44794 100000
98548 93930 100000
74791 88928 100000
25878 49015 100000
17727 94842 100000
65428 58208 100000
8926 9437 100000
47006 94145 100000
74899 3870 100000
62299 7141 100000
35042 34978 100000
15079 79818 100000
632...

output:

1200000

result:

ok single line: '1200000'

Test #49:

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

input:

100000 200000 3935
57127 13367 49241
67778 24181 49140
28690 6399 49860
27483 7928 79688
25138 58636 91891
31906 35797 92368
69010 79985 16320
99510 27145 92284
37686 35878 96371
64834 78334 33679
2601 82550 70716
13464 49093 68761
18223 42879 12332
23885 67361 48657
8924 2807 49352
34137 89274 2839...

output:

1748642318

result:

ok single line: '1748642318'

Test #50:

score: 0
Accepted
time: 93ms
memory: 22848kb

input:

100000 200000 75739
55725 21208 10754
443 17529 33408
61365 86026 9303
52176 77920 37252
73473 14908 40272
93779 99999 93120
96639 68811 70856
86745 58242 9995
8439 34947 78015
20561 27300 25106
66357 53245 86054
24156 64192 22589
14324 40837 98606
63657 49346 36019
90211 30699 84291
58453 18960 456...

output:

10001603925

result:

ok single line: '10001603925'

Test #51:

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

input:

100000 200000 53241
39360 75204 82918
17106 8511 85611
59055 33680 3818
79923 90847 52701
31834 75888 51683
61670 12239 9996
58541 94818 49988
1823 1048 9775
65208 45255 18449
49093 59480 68972
43077 90593 98127
45430 33297 23009
62594 37091 57217
15426 45626 23609
20855 56962 57619
17559 86406 9416...

output:

9983639103

result:

ok single line: '9983639103'

Test #52:

score: 0
Accepted
time: 100ms
memory: 22840kb

input:

100000 200000 41291
48617 9400 74437
39671 22130 9938
77381 13578 23838
99417 96455 67930
85875 45956 94812
61976 57722 41995
9525 15285 87346
41694 38329 79053
48837 68633 94818
30934 3953 81517
26280 75467 48206
78131 27333 40710
79780 63673 34764
37641 55938 68724
87213 31523 65810
44282 95750 47...

output:

10003946427

result:

ok single line: '10003946427'

Test #53:

score: 0
Accepted
time: 104ms
memory: 22856kb

input:

100000 200000 10734
82682 21132 94038
54129 90440 89011
20191 81046 61215
45924 2257 76693
23830 49878 19099
3007 23054 81762
73309 1071 32937
5949 93327 34842
5783 85792 56404
34098 83877 22520
57979 76380 80649
5328 81886 650
54706 21294 6888
86797 94002 96776
91128 58527 67353
5641 33718 77732
76...

output:

5009158255

result:

ok single line: '5009158255'

Test #54:

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

input:

100000 200000 39173
57334 51975 50840
6017 98405 6856
37100 85925 40680
42324 47878 10574
99291 48723 87907
83444 4563 15156
67020 46984 68943
95152 3265 82099
64526 87245 3813
82652 94347 31833
49273 39894 71432
55688 29130 1904
10190 74039 31202
57604 36694 82619
72834 37924 24680
77485 66008 4308...

output:

10020372021

result:

ok single line: '10020372021'

Test #55:

score: 0
Accepted
time: 90ms
memory: 22832kb

input:

100000 200000 40342
89773 86100 91584
79708 29558 36918
34193 37966 43639
38532 52729 2571
19829 6665 34176
59463 1135 79360
49902 93058 61740
98277 6964 64804
46948 26507 93423
35405 64539 23416
13327 93473 85348
31210 27856 72343
71066 7276 97193
19549 12301 77120
75476 30150 72817
3454 89586 9970...

output:

10027650097

result:

ok single line: '10027650097'

Test #56:

score: 0
Accepted
time: 98ms
memory: 22912kb

input:

100000 200000 100000
40495 43343 37090
29159 77264 17738
24150 8910 34294
54256 97962 27775
263 99763 96733
15234 95257 52773
65402 22466 49203
44151 54156 67346
38733 8298 37640
77465 21957 27969
80902 89080 75570
72401 19274 66034
70398 64480 28205
15472 75074 19503
1580 7307 94585
10840 66372 646...

output:

9988915665

result:

ok single line: '9988915665'

Extra Test:

score: 0
Extra Test Passed