제출 #1027495

#제출 시각아이디문제언어결과실행 시간메모리
1027495ara_araSure Bet (CEOI17_sure)C++17
100 / 100
59 ms2128 KiB
#include <bits/stdc++.h> #define int long long using namespace std; signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin>>n; double a[n+1],b[n+1]; for(int i=1;i<=n;i++){ cin>>a[i]>>b[i]; a[i]--; b[i]--; } sort(a+1,a+n+1,greater<double>()); sort(b+1,b+n+1,greater<double>()); int j=0; double sa=0,sb=0,res=0; for(int i=1;i<=n;i++){ sa+=a[i]; while(j<=n && (min(sa-j,sb-i)<min(sa-(j+1),(sb+b[j+1])-i))){ j++; sb+=b[j]; } res=max(res,min(sa-j,sb-i)); } cout<<fixed<<setprecision(4)<<res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...