# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
199670 |
2020-02-02T16:18:56 Z |
rKrPaN |
Sure Bet (CEOI17_sure) |
C++ |
|
216 ms |
2288 KB |
#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 time |
Memory |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
248 KB |
Output is correct |
4 |
Correct |
6 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
128 KB |
Output is correct |
6 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
248 KB |
Output is correct |
4 |
Correct |
6 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
128 KB |
Output is correct |
6 |
Correct |
5 ms |
376 KB |
Output is correct |
7 |
Correct |
5 ms |
256 KB |
Output is correct |
8 |
Correct |
6 ms |
376 KB |
Output is correct |
9 |
Correct |
6 ms |
256 KB |
Output is correct |
10 |
Correct |
5 ms |
256 KB |
Output is correct |
11 |
Correct |
5 ms |
256 KB |
Output is correct |
12 |
Correct |
7 ms |
380 KB |
Output is correct |
13 |
Correct |
7 ms |
376 KB |
Output is correct |
14 |
Correct |
7 ms |
376 KB |
Output is correct |
15 |
Correct |
7 ms |
376 KB |
Output is correct |
16 |
Correct |
7 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
248 KB |
Output is correct |
4 |
Correct |
6 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
128 KB |
Output is correct |
6 |
Correct |
5 ms |
376 KB |
Output is correct |
7 |
Correct |
5 ms |
256 KB |
Output is correct |
8 |
Correct |
6 ms |
376 KB |
Output is correct |
9 |
Correct |
6 ms |
256 KB |
Output is correct |
10 |
Correct |
5 ms |
256 KB |
Output is correct |
11 |
Correct |
5 ms |
256 KB |
Output is correct |
12 |
Correct |
7 ms |
380 KB |
Output is correct |
13 |
Correct |
7 ms |
376 KB |
Output is correct |
14 |
Correct |
7 ms |
376 KB |
Output is correct |
15 |
Correct |
7 ms |
376 KB |
Output is correct |
16 |
Correct |
7 ms |
376 KB |
Output is correct |
17 |
Correct |
187 ms |
2156 KB |
Output is correct |
18 |
Correct |
193 ms |
2180 KB |
Output is correct |
19 |
Correct |
196 ms |
2176 KB |
Output is correct |
20 |
Correct |
201 ms |
2152 KB |
Output is correct |
21 |
Correct |
212 ms |
2280 KB |
Output is correct |
22 |
Correct |
189 ms |
2144 KB |
Output is correct |
23 |
Correct |
191 ms |
2288 KB |
Output is correct |
24 |
Correct |
196 ms |
2144 KB |
Output is correct |
25 |
Correct |
189 ms |
2144 KB |
Output is correct |
26 |
Correct |
216 ms |
2148 KB |
Output is correct |