# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
130920 |
2019-07-16T08:59:10 Z |
Diuven |
Sure Bet (CEOI17_sure) |
C++14 |
|
104 ms |
3708 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;
const int INF = 2e9;
const int MOD = 1e9+7;
const int MAX = 1e5+10;
const lint LNF = 2e18;
int n;
double X[MAX], Y[MAX], ans;
int main(){
ios::sync_with_stdio(0); cin.tie(0);
cin>>n;
for(int i=1; i<=n; i++)
cin>>X[i]>>Y[i];
sort(X+1, X+n+1, greater<double>());
sort(Y+1, Y+n+1, greater<double>());
for(int i=1, j=1, k=1; i<=n; i++){
static double a=0, b1=0, b2=0, c1=0, c2=0;
a += X[i], c1++, c2++;
while(j<=n && b1<a) b1 += Y[j++], c1++;
while(k<=n && b2+Y[k]<=a && Y[k]>=1) b2 += Y[k++], c2++;
if(a<=b1) ans = max(ans, a-c1);
if(b2<=a) ans = max(ans, b2-c2);
}
cout<<fixed;
cout.precision(4);
cout<<ans<<'\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
3 ms |
376 KB |
Output is correct |
10 |
Correct |
3 ms |
376 KB |
Output is correct |
11 |
Correct |
1 ms |
376 KB |
Output is correct |
12 |
Correct |
3 ms |
376 KB |
Output is correct |
13 |
Correct |
3 ms |
404 KB |
Output is correct |
14 |
Correct |
3 ms |
376 KB |
Output is correct |
15 |
Correct |
3 ms |
376 KB |
Output is correct |
16 |
Correct |
3 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
3 ms |
376 KB |
Output is correct |
10 |
Correct |
3 ms |
376 KB |
Output is correct |
11 |
Correct |
1 ms |
376 KB |
Output is correct |
12 |
Correct |
3 ms |
376 KB |
Output is correct |
13 |
Correct |
3 ms |
404 KB |
Output is correct |
14 |
Correct |
3 ms |
376 KB |
Output is correct |
15 |
Correct |
3 ms |
376 KB |
Output is correct |
16 |
Correct |
3 ms |
376 KB |
Output is correct |
17 |
Correct |
97 ms |
3276 KB |
Output is correct |
18 |
Correct |
97 ms |
3232 KB |
Output is correct |
19 |
Correct |
99 ms |
3384 KB |
Output is correct |
20 |
Correct |
97 ms |
3320 KB |
Output is correct |
21 |
Correct |
99 ms |
3708 KB |
Output is correct |
22 |
Correct |
102 ms |
3320 KB |
Output is correct |
23 |
Correct |
97 ms |
3320 KB |
Output is correct |
24 |
Correct |
97 ms |
3320 KB |
Output is correct |
25 |
Correct |
97 ms |
3412 KB |
Output is correct |
26 |
Correct |
104 ms |
3704 KB |
Output is correct |