#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;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |