# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
498362 |
2021-12-25T05:07:10 Z |
Ierus |
Sure Bet (CEOI17_sure) |
C++17 |
|
353 ms |
296 KB |
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize ("unroll-loops,Ofast,O3")
#pragma GCC target("avx,avx2,fma")
#define F first
#define S second
#define sz(x) (int)x.size()
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define NFS ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0) ;
typedef long long ll;
const int E = 1e6+777;
const long long inf = 1e18+777;
const int N = 1e5+777;
const int MOD = 1e9+7;
const bool I = 1;
int n, color[N];
double a[N], b[N];
double getslow(int len = 0, int cl = -1, double cnt = 0){
if(len > 12) return 0.0;
if(len > 0){
color[len] = cl;
if(len == max(n, 12)){
double sum1 = 0, sum2 = 0;
for(int i = 1; i <= n; ++i){
if(color[i] == 1) sum1 += a[i];
else if(color[i] == 2) sum2 += b[i];
else if(color[i] == 3) sum1 += a[i], sum2 += b[i];
}
// cerr << "color\n";
// for(int i = 1; i <= n; ++i){
// cerr << color[i] << '\n';
// }cerr << '\n';
// cerr << "res1: " << sum1 - cnt << " res2: " << sum2 - cnt << '\n';
return (double)min(sum1 - cnt, sum2 - cnt);
}
}
return max({getslow(len + 1, 0, cnt), getslow(len + 1, 1, cnt + 1), getslow(len + 1, 2, cnt + 1), getslow(len + 1, 3, cnt+2)});
}
int main(){
cin >> n;
// vector<int> a(n);
for(int i = 1; i <= n; ++i){
cin >> a[i] >> b[i];
// a[i] = i;
}
// random_shuffle
cout << fixed << setprecision(4) << getslow();
};
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
91 ms |
280 KB |
Output is correct |
2 |
Correct |
89 ms |
284 KB |
Output is correct |
3 |
Correct |
349 ms |
296 KB |
Output is correct |
4 |
Correct |
342 ms |
280 KB |
Output is correct |
5 |
Correct |
353 ms |
288 KB |
Output is correct |
6 |
Correct |
351 ms |
284 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
91 ms |
280 KB |
Output is correct |
2 |
Correct |
89 ms |
284 KB |
Output is correct |
3 |
Correct |
349 ms |
296 KB |
Output is correct |
4 |
Correct |
342 ms |
280 KB |
Output is correct |
5 |
Correct |
353 ms |
288 KB |
Output is correct |
6 |
Correct |
351 ms |
284 KB |
Output is correct |
7 |
Incorrect |
71 ms |
204 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
91 ms |
280 KB |
Output is correct |
2 |
Correct |
89 ms |
284 KB |
Output is correct |
3 |
Correct |
349 ms |
296 KB |
Output is correct |
4 |
Correct |
342 ms |
280 KB |
Output is correct |
5 |
Correct |
353 ms |
288 KB |
Output is correct |
6 |
Correct |
351 ms |
284 KB |
Output is correct |
7 |
Incorrect |
71 ms |
204 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |