Submission #962679

# Submission time Handle Problem Language Result Execution time Memory
962679 2024-04-14T06:50:03 Z LucaIlie Sure Bet (CEOI17_sure) C++17
0 / 100
1 ms 348 KB
#include <iostream>
#include <algorithm>
#include <iomanip>

using namespace std;
#define nmax 100001
#define mod 10000

double a[nmax], b[nmax];
int main()
{
    int n, i, ia, ib;
    double maxx, sa, sb;
    cin >> n;
    for( i = 1; i <= n; i++ )
        cin >> a[i] >> b[i];
    sort( a + 1, a + n + 1 );
    sort( b + 1, b + n + 1 );
    ia = ib = n ;
    sa = sb = maxx = 0;
    while( ia > 0 || ib > 0 ) {
        if( min(sa + a[ia] - 1, sb - 1) > min(sa - 1, sb + b[ib] - 1) ) {
            maxx = max( maxx, min(sa + a[ia] - 1, sb - 1));
            sa += a[ia] - 1;
            sb -= 1;
            ia--;
        } else {
            maxx = max( maxx, min(sa - 1, sb + b[ib] - 1));
            sa += - 1;
            sb += b[ib] - 1;
            ib--;
        }
        //cout << maxx << " " << ia << " " << sa << " " << ib << " " << sb << "\n";
    }
    cout << fixed << setprecision( 5 ) << maxx;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -