UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#198051#3455. 寇德佛斯xue_gui_jian_chi1005871ms24648kbC++524b2023-11-19 14:02:492023-11-19 16:06:28

answer

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<queue>
#include<algorithm>
#include<iomanip>
#include<vector>
using namespace std;
const int N=1e6+5;
struct nd{
	long long s,v,t;
}a[N];
long long n,w,ans; 
bool cmp(nd a,nd b){
	if(1.0*a.v/a.t>1.0*b.v/b.t)return true;
	return false;
}
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i].s>>a[i].v>>a[i].t;
	sort(a,a+n,cmp);
	for(int i=0;i<n;i++){
		w+=a[i].t;
		ans+=a[i].s-w*a[i].v;
	}
	cout<<ans;
	return 0;
}

详细

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

Test #1:

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

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: 1212kb

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: 1236kb

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: 1ms
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: 1240kb

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: 1280ms
memory: 24644kb

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: 1587ms
memory: 24648kb

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: 1655ms
memory: 24648kb

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: 1348ms
memory: 24648kb

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