Submission #56076

# Submission time Handle Problem Language Result Execution time Memory
56076 2018-07-09T20:36:49 Z IvanC Sure Bet (CEOI17_sure) C++17
20 / 100
13 ms 736 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 + b[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 248 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 13 ms 436 KB Output is correct
4 Correct 10 ms 636 KB Output is correct
5 Correct 12 ms 636 KB Output is correct
6 Correct 9 ms 636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 13 ms 436 KB Output is correct
4 Correct 10 ms 636 KB Output is correct
5 Correct 12 ms 636 KB Output is correct
6 Correct 9 ms 636 KB Output is correct
7 Runtime error 3 ms 736 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 13 ms 436 KB Output is correct
4 Correct 10 ms 636 KB Output is correct
5 Correct 12 ms 636 KB Output is correct
6 Correct 9 ms 636 KB Output is correct
7 Runtime error 3 ms 736 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Halted 0 ms 0 KB -