QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#431228#4186. Card Tradingkevinyang#WA 39ms7188kbC++14903b2024-06-05 06:49:502024-06-05 06:49:50

Judging History

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

  • [2024-06-05 06:49:50]
  • 评测
  • 测评结果:WA
  • 用时:39ms
  • 内存:7188kb
  • [2024-06-05 06:49:50]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
struct node{
	double d;
	int x,y;
};
bool comp(node a, node b){
	return a.d < b.d;
}
signed main(){
	cin.tie(nullptr)->sync_with_stdio(false);
	int n;
	cin >> n;
	vector<node>arr(n);
	for(int i = 0; i<n; i++){
		double d;
		cin >> d;
		int x,y;
		cin >> x >> y;
		arr[i] = {d,x,y};
	}
	sort(arr.begin(),arr.end(),comp);
	vector<int>p(n);
	vector<int>s(n);
	p[0] = arr[0].y;
	s[n-1]= arr[n-1].x;
	for(int i = 1; i<n; i++){
		p[i] = p[i-1] + arr[i].y;
	}
	for(int i = n-2; i>=0; i--){
		s[i] = s[i+1] + arr[i].x;
	}
	pair<double,double> ans = {0,0};
	for(int i = 0; i<n; i++){
		ans = max(ans,{min(s[i],p[i])*arr[i].d, arr[i].d});
	}
	if(ans.first <= 0){
		cout << "impossible\n";
	}
	else{
		cout << fixed << setprecision(2);
		cout << ans.second << ' ' << ans.first << '\n';
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
12.00 0 3
11.99 2 0
11.98 5 0
10.00 1 0
12.01 0 6

output:

impossible

result:

ok 

Test #2:

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

input:

6
2.85 14 0
4.50 0 1
5.26 3 3
6.17 1 0
14.78 0 2
21.04 1 0

output:

21.04 21.04

result:

ok 

Test #3:

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

input:

6
2.85 14 0
4.50 0 1
5.26 2 3
14.78 0 2
1.83 0 1
21.04 1 0

output:

21.04 21.04

result:

ok 

Test #4:

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

input:

2
17.10 2 19
29.05 20 11

output:

29.05 581.00

result:

ok 

Test #5:

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

input:

5
12.10 5 3
15.00 7 0
16.84 4 0
21.20 1201 0
28.10 3 0

output:

28.10 84.30

result:

ok 

Test #6:

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

input:

5
5.12 10 2
13.99 0 10
14.02 0 2910
7.12 0 20
10.81 0 12

output:

5.12 10.24

result:

ok 

Test #7:

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

input:

100
5106.50 0 420
5647.73 0 140
4384.77 0 323
7.35 441 0
5131.09 0 348
8153.31 0 474
3657.73 0 434
2096.41 190 0
7662.17 0 92
3957.59 0 238
1508.36 466 0
5900.07 0 307
9080.20 0 71
4338.20 0 46
2928.67 0 261
5600.58 0 499
2101.17 426 0
8716.93 0 442
6915.79 0 333
4551.97 0 309
5066.55 0 225
6273.77 ...

output:

impossible

result:

ok 

Test #8:

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

input:

200
5171.23 0 122
5808.37 0 371
4190.17 997 0
3293.86 345 0
9817.15 0 705
8863.74 0 878
4995.64 140 0
6618.92 0 303
7090.58 0 858
8446.03 0 418
3236.52 945 0
1458.66 403 0
1104.90 795 0
2780.13 221 0
13.54 124 0
8447.64 0 104
1583.13 563 0
2275.28 90 0
3404.38 681 0
5946.32 0 660
4152.10 94 0
4940.5...

output:

impossible

result:

ok 

Test #9:

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

input:

100
7155.14 416 12
163.14 81 166
7962.24 352 1
6825.21 415 435
2090.45 425 288
8119.88 283 295
4277.91 492 334
7693.51 157 402
4657.80 363 193
881.99 355 311
7607.73 217 60
2556.32 121 121
4961.12 4 353
2204.87 133 252
4477.32 24 161
9919.17 137 52
7274.38 391 49
5414.28 304 429
372.51 415 180
3007....

output:

5219.93 62858397.06

result:

ok 

Test #10:

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

input:

100
435.27 204 248
9851.84 374 60
6300.48 220 170
3207.77 52 437
1635.81 227 134
4559.56 64 330
1027.98 275 439
3493.54 116 486
8807.16 424 208
6108.91 232 158
6002.40 247 49
6199.99 231 463
7779.28 156 325
1564.84 119 154
8545.27 92 379
6243.03 47 481
6434.01 182 18
630.72 213 193
2227.44 18 37
174...

output:

6002.40 60846328.80

result:

ok 

Test #11:

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

input:

100
8162.09 309 134
9465.46 86 286
7802.02 26 28
6105.68 143 294
5029.76 91 276
3078.43 388 32
7355.32 331 255
2093.59 37 357
9587.76 306 249
360.09 81 258
1089.36 104 35
2453.63 70 453
8390.15 127 313
3968.22 126 391
5578.74 454 174
486.23 32 91
952.72 87 152
2991.77 384 142
684.42 290 220
8327.64 ...

output:

5377.50 66664867.50

result:

ok 

Test #12:

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

input:

100000
9427.08 1000000 1000000
9919.96 1000000 1000000
9696.73 1000000 1000000
9262.83 1000000 1000000
9849.26 1000000 1000000
9288.06 1000000 1000000
9280.57 1000000 1000000
9820.40 1000000 1000000
9482.02 1000000 1000000
9269.87 1000000 1000000
9764.40 1000000 1000000
9926.93 1000000 1000000
9945....

output:

9500.01 475000500000000.00

result:

ok 

Test #13:

score: -100
Wrong Answer
time: 39ms
memory: 7172kb

input:

100000
9521.36 1000000 1000000
9857.50 1000000 1000000
9622.01 1000000 1000000
9879.31 1000000 1000000
9780.70 1000000 1000000
9997.30 1000000 1000000
9957.80 1000000 1000000
9731.46 1000000 1000000
9565.23 1000000 1000000
9040.76 1000000 1000000
9223.91 1000000 1000000
9383.68 1000000 1000000
9551....

output:

9500.01 475000499990500.00

result:

wrong answer Wrong answer: Author price / turnover mismatch (Only 49999999999 fulfilled orders for a total turnover of 475000499990499.99 instead of 475000499990500.00).