Submission #56075

# Submission time Handle Problem Language Result Execution time Memory
56075 2018-07-09T20:35:55 Z IvanC Sure Bet (CEOI17_sure) C++17
0 / 100
2 ms 488 KB
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 20;

double a[MAXN],b[MAXN],melhor;
int N;

void brute(int atual,double s1,double s2,int qtd){
  if(atual == N){
    melhor = max(melhor, min(s1,s2) - qtd );
    return;
  }
  brute(atual+1,s1 + a[atual],s2,qtd+1);
  brute(atual+1,s1,s2 + b[atual],qtd+1);
  brute(atual+1,s1+a[atual],s2 + a[atual],qtd + 2);
  brute(atual+1,s1,s2,qtd);
}

int main(){
  cin >> N;
  for(int i = 0;i<N;i++) cin >> a[i] >> b[i];
  brute(0,0,0,0);
  printf("%.4lf\n",melhor);
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 488 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 488 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 488 KB Output isn't correct
3 Halted 0 ms 0 KB -