# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
161803 | dantoh000 | Sure Bet (CEOI17_sure) | C++14 | 2 ms | 376 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
int n;
scanf("%d",&n);
int a[n], b[n];
for (int i = 0; i < n; i++){
double x,y;
scanf("%lf%lf",&x,&y);
x = (10000)*x + 0.1;
y = (10000)*y + 0.1;
a[i] = x, b[i] = y;
}
sort(a,a+n,greater<int>());
sort(b,b+n,greater<int>());
int ida = 0, idb = 0;
ll suma = 0, sumb = 0;
ll ans = 0;
for (int i = 1; i <= 2*n; i++){
if (ida != n && suma < sumb){
suma += a[ida];
ida++;
}
else{
sumb += b[idb];
idb++;
}
ans = max(ans,max(0ll,min(suma,sumb)-10000ll*i));
}
double actans = ((double)ans)/10000;
printf("%.4f",actans);
}
컴파일 시 표준 에러 (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... |