# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
534230 | LittleOrange | Let's Win the Election (JOI22_ho_t3) | C++17 | 2592 ms | 324 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool cmp(pair<double,double> a,pair<double,double> b){
return a.second==b.second?a.first<b.first:(b.second<0&&a.second>=0||a.second>=0&&a.second<b.second);
}
int main(){
ios::sync_with_stdio(0);cin.tie(0);
int n,k;
cin >> n >> k;
vector<pair<double,double> > dat(n);
int l = n;
for (int i = 0;i<n;i++){
cin >> dat[i].first >> dat[i].second;
if (dat[i].second<0) l--;
}
double ans = 1000000;
for (int i = 0;i<min(k,l+1);i++){
double t = 0;
sort(dat.begin(),dat.end(),cmp);
for (int j = 0;j<i;j++){
if (dat[j].second<0){
t += dat[j].second/(j+1);
}else{
t += dat[j].first/(j+1);
j--;
}
}
sort(dat.begin()+i,dat.end());
for (int j = i;j<k;j++){
t += dat[j].first/(i+1);
}
ans = min(ans,t);
}
cout << fixed << setprecision(15) << ans << "\n";
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |