/*
coded by : Bissultanov Yedyge;
:)
*/
#include <bits/stdc++.h>
#define ioi return 0;
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define int long long
#define sz size()
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
const int N = 1e7;
using namespace std;
int a[N],b[N],n;
int cnt;
void rec( int pos = 1 , int x = 0 , int y = 0 , int total = 0 ){
if ( pos > n ){
cnt = max(cnt , (min(x,y)-total));
return;
}
rec(pos+1,x,y,total);
rec(pos+1,x+a[pos],y,total+1);
rec(pos+1,x,y+b[pos],total+1);
rec(pos+1,x+a[pos],y+b[pos],total+2);
}
main(){
cin >> n;
for ( int i = 1 ; i <= n ; ++i ){
cin >> a[i] >> b[i];
}
rec();
cout << fixed << setprecision(4) << (double)cnt << endl;
ioi
}
Compilation message
sure.cpp:37:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main(){
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
256 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
256 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
256 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |