답안 #1027190

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1027190 2024-07-19T01:54:24 Z cnn008 Sure Bet (CEOI17_sure) C++17
20 / 100
48 ms 604 KB
#include "bits/stdc++.h"
using namespace std;

#ifdef N_N_C
#include "debug.h"
#else
#define cebug(...) "Arya"
#endif

#define ll long long

const int N=1e5+5;
const int mod=1e9+7;

int n;
double a[N],b[N],ans=0;
void sol(){
	cin>>n;
	assert(n<=10);
	for(int i=1; i<=n; i++) cin>>a[i]>>b[i];
	for(int ma=0; ma<(1<<n); ma++){
		for(int mb=0; mb<(1<<n); mb++){
			double s1=0,s2=0;
			double v1=0,v2=0;
			for(int i=0; i<n; i++) if((ma>>i)&1) v1+=1.0,s1+=a[i+1];
			for(int i=0; i<n; i++) if((mb>>i)&1) v2+=1.0,s2+=b[i+1];
			ans=max(ans,min(s1-v1-v2,s2-v1-v2));
		}
	}
	printf("%.4lf",(double)ans);
}
signed main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // freopen(".inp", "r", stdin);
    // freopen(".out", "w", stdout);
    int tt=1;
    //cin>>tt; 
    while(tt--){
    	sol();
    }
    cerr << "\nTime elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << " ms.\n";
    return 0;
}
/**  /\_/\
*   (= ._.)
*   / >💖 \>💕
**/

Compilation message

sure.cpp:45:9: warning: "/*" within comment [-Wcomment]
   45 | /**  /\_/\
      |
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 48 ms 440 KB Output is correct
4 Correct 47 ms 348 KB Output is correct
5 Correct 47 ms 348 KB Output is correct
6 Correct 47 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 48 ms 440 KB Output is correct
4 Correct 47 ms 348 KB Output is correct
5 Correct 47 ms 348 KB Output is correct
6 Correct 47 ms 348 KB Output is correct
7 Runtime error 1 ms 604 KB Execution killed with signal 6
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 48 ms 440 KB Output is correct
4 Correct 47 ms 348 KB Output is correct
5 Correct 47 ms 348 KB Output is correct
6 Correct 47 ms 348 KB Output is correct
7 Runtime error 1 ms 604 KB Execution killed with signal 6
8 Halted 0 ms 0 KB -