QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#121178#6120. Good PizzaBZJRNWA 2ms1864kbC++14322b2023-07-07 18:28:562023-07-07 18:28: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-07 18:28:59]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:1864kb
  • [2023-07-07 18:28:56]
  • 提交

answer

#include<stdio.h>
#include<algorithm>
using namespace std;
struct u{int t,a;}c[100002];
bool cm(u x,u y){return (x.t*2+1)*y.a<(y.t*2+1)*x.a;}
int N,s,k,i;
int main(){
	for(scanf("%d",&N);k<N;++k)scanf("%d%d",&c[k].t,&c[k].a);
	for(sort(c,c+N,cm),k=0;i<N;++i)s+=(c[i].t+k+i)*c[i].a,k+=c[i].t*2;
	printf("%d",s);
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
10 3
3 8
4 2

output:

124

result:

ok 1 number(s): "124"

Test #2:

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

input:

10
17 62
30 79
99 2
88 57
42 46
84 11
44 60
21 98
68 63
17 54

output:

118250

result:

ok 1 number(s): "118250"

Test #3:

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

input:

43
92 83
99 20
100 60
89 10
60 85
1 19
60 4
75 23
53 22
31 84
2 29
72 52
72 18
48 39
1 37
17 79
13 31
89 74
92 76
9 26
77 35
98 1
76 89
72 26
93 49
42 79
7 54
67 68
27 48
5 94
57 4
98 77
13 32
11 37
9 7
81 77
8 26
24 14
51 92
80 64
34 29
90 43
18 63

output:

2242658

result:

ok 1 number(s): "2242658"

Test #4:

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

input:

32
20 43
20 64
5 18
7 70
10 44
13 94
51 20
95 23
66 37
44 23
27 39
45 16
94 65
14 62
80 63
10 64
98 90
23 15
20 30
92 58
95 100
7 56
97 31
15 43
87 31
6 26
6 78
88 76
69 65
20 1
3 37
82 11

output:

1014143

result:

ok 1 number(s): "1014143"

Test #5:

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

input:

80
77 87
11 34
78 7
8 18
83 54
91 25
79 55
60 80
96 2
18 66
80 81
5 74
30 86
45 7
19 50
77 22
57 22
61 68
52 60
26 64
54 32
20 12
72 61
47 50
85 94
71 100
54 46
74 4
65 26
2 45
33 42
54 67
73 61
41 51
1 97
78 88
59 31
52 6
22 62
27 54
58 97
18 11
26 58
3 21
56 87
28 90
23 2
40 18
69 43
52 40
100 97
...

output:

8228220

result:

ok 1 number(s): "8228220"

Test #6:

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

input:

98
46 10
13 99
67 69
23 83
17 86
10 78
64 91
88 98
88 15
55 16
7 85
99 43
89 69
19 86
14 65
7 82
93 96
11 34
40 96
64 65
52 39
42 42
52 43
23 45
50 60
8 30
42 98
25 10
56 2
62 86
34 24
34 90
27 93
33 43
15 40
77 36
1 65
45 75
62 72
72 85
36 72
40 60
33 34
82 48
90 60
72 13
84 88
98 18
34 29
13 68
71...

output:

13754870

result:

ok 1 number(s): "13754870"

Test #7:

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

input:

43
54 31
93 27
18 19
40 34
89 82
71 54
30 27
75 87
75 31
54 34
21 78
77 86
63 1
74 70
90 40
7 15
20 40
25 8
84 58
28 46
57 70
1 100
52 64
77 84
54 85
33 14
61 63
2 62
70 4
45 64
60 5
36 50
98 73
50 75
33 37
46 13
21 83
9 61
59 18
33 22
95 23
74 46
83 51

output:

2623535

result:

ok 1 number(s): "2623535"

Test #8:

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

input:

34
20 42
95 49
90 25
95 80
27 80
84 14
84 39
41 32
76 29
42 58
52 80
77 7
65 41
42 91
39 91
21 10
37 32
17 38
57 50
70 17
49 33
67 17
54 13
42 98
6 9
82 1
65 83
87 63
46 59
97 45
15 22
28 12
83 21
35 31

output:

1475049

result:

ok 1 number(s): "1475049"

Test #9:

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

input:

35
1 45
58 22
81 82
12 31
52 61
69 58
7 47
38 86
94 86
35 72
46 59
71 46
77 22
41 29
55 63
68 6
26 1
61 42
37 56
43 34
4 62
31 12
75 50
87 47
7 18
54 88
21 60
57 54
57 74
80 60
72 32
44 89
35 64
1 85
30 63

output:

1738455

result:

ok 1 number(s): "1738455"

Test #10:

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

input:

53
32 79
17 73
82 19
15 71
68 23
98 36
74 6
25 80
93 54
100 42
73 34
16 5
37 64
87 80
71 61
14 3
86 7
98 55
1 33
35 80
32 61
41 41
96 16
14 84
57 42
75 25
23 55
51 2
78 18
3 33
40 84
24 91
16 60
100 70
6 90
8 49
46 48
49 3
4 3
69 83
55 86
61 65
50 35
92 28
14 52
96 25
48 89
78 15
51 38
79 62
99 67
1...

output:

3143769

result:

ok 1 number(s): "3143769"

Test #11:

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

input:

40
93 88
65 29
62 98
62 41
60 50
18 54
58 4
33 58
32 49
46 77
29 41
33 71
18 81
65 28
87 20
29 97
90 17
3 40
63 83
15 61
88 31
57 80
14 6
66 85
52 78
64 3
71 59
97 47
10 18
59 55
58 68
98 99
8 94
73 48
32 36
57 80
83 66
55 86
39 90
55 42

output:

2828773

result:

ok 1 number(s): "2828773"

Test #12:

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

input:

42
60 2
82 30
54 9
27 17
2 75
36 36
91 3
2 85
11 19
62 8
94 45
71 16
5 93
12 23
1 78
67 14
86 15
88 3
80 21
14 12
60 7
45 25
62 61
6 15
22 86
80 32
86 15
57 59
79 27
25 24
52 78
62 23
93 15
19 57
9 85
7 80
60 46
98 72
86 84
40 35
33 2
41 16

output:

1134960

result:

ok 1 number(s): "1134960"

Test #13:

score: -100
Wrong Answer
time: 2ms
memory: 1608kb

input:

9712
714 112
644 660
686 209
14 495
691 352
916 289
47 127
962 364
247 46
351 463
113 746
289 286
570 971
238 529
850 974
292 440
79 760
927 270
483 75
405 480
405 403
724 760
259 248
572 303
93 396
574 677
832 98
888 646
698 107
547 476
739 988
614 148
785 2
890 210
749 511
265 951
677 579
857 9
14...

output:

1477126485

result:

wrong answer 1st numbers differ - expected: '12113284901205', found: '1477126485'