답안 #878645

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
878645 2023-11-25T03:04:13 Z Muhammad_Aneeq Sure Bet (CEOI17_sure) C++17
0 / 100
0 ms 348 KB
/*
بسم الله الرحمن الرحيم
Author:
                          (:Muhammad Aneeq:)
*/
#pragma GCC optimize("O2")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define ld long double
inline void solve()
{
  int n;
  cin>>n;
  vector<ld>a,b;
  for (int i=0;i<n;i++)
  {
    ld x,y;
    cin>>x>>y;
    a.push_back(x);
    b.push_back(y);
  }
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  sort(b.begin(), b.end());
  reverse(b.begin(), b.end());
  ld ans=0;
  int i=0,j=0;
  ld sa=0,sb=0;
  while (i<n||j<n)
  {
    if (i==n||sa>sb)
      sb+=b[j++];
    else
      sa+=a[i++];
    ans=max(ans,min(sb-(i+j),sa-(i+j)));
  }
  printf("%.4lf\n",(double)ans);
}
int main()
{
  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
        solve();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -