답안 #757812

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
757812 2023-06-13T18:52:51 Z taher Sure Bet (CEOI17_sure) C++17
100 / 100
76 ms 3536 KB
#include <bits/stdc++.h>

using namespace std;

void update(double &best , double even , double odd){
  best = max(best , min(even , odd));  
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<double> one(n) , two(n);
  for(int i = 0 ; i < n ; i++){
    cin >> one[i] >> two[i];
  }
  sort(one.rbegin(),one.rend());
  sort(two.rbegin(),two.rend());
  double even  = 0 , odd = 0;
  double best = 0;
  int i = 0 , j = 0;
  while(i < n || j < n){
    if(even < odd && i < n){
      even += one[i] - 1;
      odd--;
      update(best , even , odd);
      i++;
    }
    else if(even >= odd && j < n){
      odd += two[j] - 1;
      even--;
      update(best , even , odd);
      j++;
    }
    else break;
  }
  cout << setprecision(4) << fixed << best << '\n';
  return 0; 
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 356 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 356 KB Output is correct
17 Correct 72 ms 3144 KB Output is correct
18 Correct 70 ms 3256 KB Output is correct
19 Correct 70 ms 3252 KB Output is correct
20 Correct 68 ms 3256 KB Output is correct
21 Correct 75 ms 3532 KB Output is correct
22 Correct 68 ms 3160 KB Output is correct
23 Correct 70 ms 3156 KB Output is correct
24 Correct 73 ms 3148 KB Output is correct
25 Correct 73 ms 3144 KB Output is correct
26 Correct 76 ms 3536 KB Output is correct