답안 #878636

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
878636 2023-11-25T02:47:01 Z Faisal_Saqib Sure Bet (CEOI17_sure) C++17
0 / 100
47 ms 412 KB
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;
#define int long long
const int N=1001;
long long p4[N];
signed main()
{
    cout<<fixed<<setprecision(4);
    int n;
    cin>>n;
    p4[0]=1;
    for(int i=1;i<=n;i++)
        p4[i]=(p4[i-1]*4ll);
    vector<int> a,b;
    for(int i=0;i<n;i++)
    {
        double x,y;
        cin>>x>>y;
      x*=1e4;
      y*=1e4;
        a.push_back(x);
        b.push_back(y);
    }
    int ans=0;
    for(long long mask=0;mask<p4[n];mask++)
    {
        int s1=0,s2=0;
        int p=0;
        long long cur=mask;
        for(int j=0;j<n;j++)
        {
            if(cur%4==3)
            {
                s1+=a[j];
                s2+=b[j];
                p+=2;
            }
            else if(cur%4==2)
            {
                p++;
                s1+=a[j];
            }
            else if(cur%4==1)
            {
                p++;
                s2+=b[j];
            }
            cur/=4;
        }
        p*=(1e4);
        ans=max(ans,min(s1,s2)-p);
    }
  long double x=(long double)ans/(long double)(1e4);
    cout<<x<<endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 47 ms 348 KB Output is correct
4 Correct 46 ms 348 KB Output is correct
5 Correct 46 ms 412 KB Output is correct
6 Incorrect 47 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 47 ms 348 KB Output is correct
4 Correct 46 ms 348 KB Output is correct
5 Correct 46 ms 412 KB Output is correct
6 Incorrect 47 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 47 ms 348 KB Output is correct
4 Correct 46 ms 348 KB Output is correct
5 Correct 46 ms 412 KB Output is correct
6 Incorrect 47 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -