Submission #520135

# Submission time Handle Problem Language Result Execution time Memory
520135 2022-01-28T13:50:22 Z tost_one_love Sure Bet (CEOI17_sure) C++14
0 / 100
1 ms 336 KB
#include <bits/stdc++.h>
  
#define endl "\n"
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define sz size()
#define rep(i,k,n) for(int i = k ; i <= n ; ++i)
#define per(i,k,n) for(int i = k ; i >= n ; --i)
#define YOSIK() ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define all(x) x.begin(),x.end()
#define fr(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout)
#define toqta return 0
#define PERMUTE next_permutation
#define no cout<<"No"<<endl;
#define yes cout<<"Yes"<<endl;
#define a() a + 1, a + n + 1  
 
using namespace std;
 
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse,-fgcse-lm")
#pragma GCC optimize("-ftree-pre,-ftree-vrp")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("unroll-loops")
 
   
typedef long long ll;
typedef unsigned long long ull;
typedef string S;
typedef double ld;
typedef long double lld;
  
const int N = 1e6 + 17;
const int modd = 1e9 + 7;
const ll INF = 1e18 - 19;
const int P = 37;
const ll NN = 1e7 + 17;
const ld eps = 1e-19;
const double pi = 3.141592653589793238462643383279 ;
   
 
bool sortbysec(const pair<int,int> &a, const pair<int,int> &b){
    return (a.second < b.second);
}
 
void pre (ll a) {
    cout << fixed << setprecision(a);
    return;
}
 
ll n;
double x[N], y[N];
double mx;
bool ok = 0;	
inline void Solution (/*Nuraly Serikbay*/) {
	cin >> n;
	for (int i = 1; i <= n; ++ i) {
		cin >> x[i] >> y[i];
	}
	sort (x + 1, x + n + 1);
	sort (y + 1, y + n + 1);
	for (int i = 1; i <= n; ++ i) {
		for (int j = 1; j <= n; ++ j) {
			double sum = 0, sum1 = 0;
			ll cnt1 = n;
			ll cur1 = j;
			ll cnt2 = n, cur2 = i;
			bool b = 0, b2 = 0;
			while (b == 0 and b2 == 0) {
				if (cur1){
					sum += x[cnt1];
					cnt1 --;
					cur1 --;
				}else
					b = 1;
				if (cur2){
					sum1 += y[cnt2];
					cnt2 --;
					cur2 --;
				}else
					b2 = 1;
			}
			if (sum >= i + j && sum1 >= i + j) {
				mx = max (mx, min (sum - (i + j), sum1 - (i + j)));
			}
		}
	}
	pre(4);
	cout << mx;	
	return;
}
 
 
int main () {
	YOSIK();
	Solution ();
	exit (0);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Incorrect 1 ms 328 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Incorrect 1 ms 328 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Incorrect 1 ms 328 KB Output isn't correct
5 Halted 0 ms 0 KB -