UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#198039#3455. 寇德佛斯shiruiheng1001805ms24644kbC++11526b2023-11-19 13:33:452023-11-19 16:05:10

answer

#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll n, sum;
struct task{
	ll s, v, t;
	int read(){
		return scanf("%lld%lld%lld", &s, &v, &t);
	}
	bool operator<(const task &t1)const{
		return t * t1.v < t1.t * v;
	}
}a[1000010];
signed main()
{
    scanf("%lld", &n);
    for(int i = 1 ; i <= n ; i++){
    	a[i].read();
    	sum += a[i].s;
	}
	sort(a + 1, a + 1 + n);
	ll t = 0;
	for(int i = 1 ; i <= n ; i++)
		sum -= (t += a[i].t) * a[i].v;
	printf("%lld", sum);
    exit(0);
}

详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 10
Accepted
time: 0ms
memory: 1208kb

input:

10
36 2 2
30 2 1
36 3 1
31 3 2
35 2 2
36 1 1
33 3 2
33 2 2
31 1 2
31 1 1

output:

192

result:

ok single line: '192'

Test #2:

score: 10
Accepted
time: 0ms
memory: 1208kb

input:

10
31 2 2
38 3 2
34 3 1
33 1 2
38 3 1
35 3 2
39 2 1
35 2 1
33 3 1
31 2 1

output:

207

result:

ok single line: '207'

Test #3:

score: 10
Accepted
time: 0ms
memory: 1208kb

input:

10
40 1 1
38 3 1
33 2 2
31 3 2
36 3 2
34 1 2
30 1 1
34 2 2
31 3 2
34 1 2

output:

196

result:

ok single line: '196'

Test #4:

score: 10
Accepted
time: 0ms
memory: 1228kb

input:

1000
821730 88 58
868878 10 49
730608 87 56
358378 21 39
321454 79 55
575454 80 54
238342 60 87
9675...

output:

-207648101

result:

ok single line: '-207648101'

Test #5:

score: 10
Accepted
time: 0ms
memory: 1236kb

input:

1000
295674 20 37
530507 83 34
315912 43 49
114140 17 70
783671 48 35
396223 84 20
848938 22 48
3692...

output:

-247786358

result:

ok single line: '-247786358'

Test #6:

score: 10
Accepted
time: 0ms
memory: 1236kb

input:

1000
994667 17 41
106569 48 20
228079 48 41
607379 38 84
593976 40 38
216992 34 44
884581 34 65
1815...

output:

-189420208

result:

ok single line: '-189420208'

Test #7:

score: 10
Accepted
time: 341ms
memory: 24640kb

input:

1000000
350938561 10248 10454
719096197 54692 29785
493023278 48605 127509
522828155 89768 282375
10...

output:

555671037091942707

result:

ok single line: '555671037091942707'

Test #8:

score: 10
Accepted
time: 352ms
memory: 24640kb

input:

1000000
533136646 39620 52619
407344442 81670 65617
882824562 93220 73699
132198087 80380 73734
4328...

output:

498831005586624164

result:

ok single line: '498831005586624164'

Test #9:

score: 10
Accepted
time: 582ms
memory: 24644kb

input:

1000000
510302022 39416 315270
389008019 18647 98158
372625845 28286 2045
846600729 81020 59062
1534...

output:

48132090766075035

result:

ok single line: '48132090766075035'

Test #10:

score: 10
Accepted
time: 530ms
memory: 24640kb

input:

1000000
383677880 89105 53362
190432717 74283 263630
962327593 88363 82070
249763080 12408 140024
79...

output:

986732232553972626

result:

ok single line: '986732232553972626'

Extra Test:

score: 0
Extra Test Passed