Submission #1032859

# Submission time Handle Problem Language Result Execution time Memory
1032859 2024-07-24T10:01:18 Z amine_aroua Sure Bet (CEOI17_sure) C++17
20 / 100
50 ms 600 KB
#include<bits/stdc++.h> 
using namespace std;
int main()
{
    int n ;
    cin>>n;
    vector<double> a(n) , b(n);
    int sm1 = 0 , sm2 = 0;
    for(int i = 0 ; i < n ; i++)
    {
        cin>>a[i]>>b[i];
        sm1+=a[i] - 2;
        sm2+=b[i] - 2;
    }

    double ans = 0;
    for(int mask = 0 ; mask < (1<<(2 * n)) ; mask++)
    {
        double f = 0 , s = 0;
        for(int i = 0 ; i < n ; i++)
        {
            int bit = (mask >> (2*i)) - 4 * (mask >> (2*(i + 1)));
            if(bit == 0)
            {
                continue;
            }
            else if(bit == 1)
            {
                f+=a[i] - 1;
                s--;
            }
            else if(bit == 2)
            {
                f--;
                s+=b[i] - 1;
            }
            else
            {
                f+=a[i] - 2;
                s+=b[i] - 2;
            }
        }
        ans = max(ans , min(f , s));
    }
    printf("%.4lf",(double)ans);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 49 ms 600 KB Output is correct
4 Correct 48 ms 408 KB Output is correct
5 Correct 50 ms 344 KB Output is correct
6 Correct 47 ms 596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 49 ms 600 KB Output is correct
4 Correct 48 ms 408 KB Output is correct
5 Correct 50 ms 344 KB Output is correct
6 Correct 47 ms 596 KB Output is correct
7 Incorrect 0 ms 344 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 49 ms 600 KB Output is correct
4 Correct 48 ms 408 KB Output is correct
5 Correct 50 ms 344 KB Output is correct
6 Correct 47 ms 596 KB Output is correct
7 Incorrect 0 ms 344 KB Output isn't correct
8 Halted 0 ms 0 KB -