Submission #00093


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <bits/stdc++.h>
#define endl "\n"
#define INF INT_MAX
using namespace std;
int main(){
#define int long long
cin.tie(nullptr);ios::sync_with_stdio(false);
int n;
cin >>n;
int a,b;
cin >>a>>b;
int x;
cin >>x;
long double c = x/a;
int sum = x,value = a;
//cout <<c<<endl;
vector<int>y(n);
for(int i = 0;i < n;i++)cin>>y[i];
sort(y.rbegin(),y.rend());
for(int i = 0;i < n;i++){
if((long double)y[i]/b >= c){
sum +=y[i],value +=b;
c = (long double)sum/value;
}
//cout <<c<<endl;
}
cout <<(int)sum/value<<endl;
}

ステータス

項目 データ
問題 0005 - 最高のピザ(Best Pizza)
ユーザー名 ei2332
投稿日時 2023-11-13 17:46:10
言語 C++17
状態 Accepted
得点 100
ソースコード長 571 Byte
最大実行時間 20 ms
最大メモリ使用量 640 KB

セット

セット 得点 Cases
1 in1 20 / 20 in1.txt
2 in2 20 / 20 in2.txt
3 in3 20 / 20 in3.txt
4 in4 20 / 20 in4.txt
5 in5 20 / 20 in5.txt

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in1.txt AC 16 ms 604 KB
1
in2.txt AC 20 ms 560 KB
2
in3.txt AC 18 ms 640 KB
3
in4.txt AC 20 ms 596 KB
4
in5.txt AC 16 ms 548 KB
5