답안 #359752

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
359752 2021-01-27T07:37:05 Z shahriarkhan Sure Bet (CEOI17_sure) C++14
0 / 100
1 ms 364 KB
#include<bits/stdc++.h>
using namespace std ;

const long long c = 1e4 ;

int main()
{
    int n ;
    scanf("%d",&n) ;
    priority_queue<long long> a , b ;
    long long x = 0 , y = 0 , ans = 0 ;
    for(int i = 1 ; i <= n ; ++i)
    {
        double ad , bd ;
        cin>>ad>>bd ;
        long long ac = (ad*c) , bc = (bd*c) ;
        a.push(ac-c) , b.push(bc-c) ;
    }
    while(!a.empty())
    {
        x += a.top() , y -= c ;
        a.pop() ;
        while(!b.empty())
        {
            if(min(x-c,y+b.top())>=min(x,y))
            {
                x -= c , y += b.top() ;
                b.pop() ;
            }
            else break ;
        }
        ans = max(ans,min(x,y)) ;
    }
    double p = ans , q = c ;
    cout<<fixed<<setprecision(4)<<p/q<<endl ;
    return 0 ;
}

Compilation message

sure.cpp: In function 'int main()':
sure.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    9 |     scanf("%d",&n) ;
      |     ~~~~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Incorrect 1 ms 364 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Incorrect 1 ms 364 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Incorrect 1 ms 364 KB Output isn't correct