Submission #1032856

# Submission time Handle Problem Language Result Execution time Memory
1032856 2024-07-24T09:59:26 Z amine_aroua Sure Bet (CEOI17_sure) C++17
0 / 100
0 ms 344 KB
#include<bits/stdc++.h> 
using namespace std;
int main()
{
    int n ;
    cin>>n;
    vector<double> a(n) , b(n);
    for(int i = 0 ; i < n ; i++)
    {
        cin>>a[i]>>b[i];
    }
    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));
    }
    cout<<ans<<'\n';
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -