Submission #199670

#TimeUsernameProblemLanguageResultExecution timeMemory
199670rKrPaNSure Bet (CEOI17_sure)C++98
100 / 100
216 ms2288 KiB
#include <iostream> #include <vector> #include <algorithm> #include <cstdio> using namespace std; vector <double> x; vector <double> y; bool comp(double a, double b){ return a > b; } int main(){ int n; cin >> n; for (int i = 0; i < n; i++){ double a, b; cin >> a >> b; x.push_back(a); y.push_back(b); } sort(x.begin(), x.end(), comp); sort(y.begin(), y.end(), comp); x[0]--; y[0]--; for (int i = 1; i < n; i++){ x[i] = x[i]-1 + x[i-1]; y[i] = y[i]-1 + y[i-1]; } int i = 0, j = 0; double mx = 0; while (i < n && j < n){ double a = x[i]-j-1; double b = y[j]-i-1; if (a <= b)i++; if (a > b)j++; if (min(a,b) > mx)mx = min(a,b); } printf("%.4lf",(double)mx); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...