Submission #711112

# Submission time Handle Problem Language Result Execution time Memory
711112 2023-03-16T08:47:01 Z WonderfulWhale Sure Bet (CEOI17_sure) C++17
60 / 100
2000 ms 5020 KB
#include<bits/stdc++.h>
using namespace std;

#define int int64_t
#define pb push_back
#define pii pair<int, int>
#define st first
#define nd second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()

int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n;
	cin >> n;
	vector<pair<double, double>> v1, v2;
	for(int i=0;i<n;i++) {
		double x, y;
		cin >> x >> y;
		v1.pb({-x, -y});
		v2.pb({-y, -x});
	}
	sort(all(v1));
	sort(all(v2));
	double ans = 0;
	double sum1 = 0;
	for(int i=0;i<=n;i++) {
		if(i) sum1 -= v1[i-1].st;
		double sum2 = 0;
		for(int j=0;j<=n;j++) {
			if(j) sum2 -= v2[j-1].st;
			ans = max(ans, min(sum1, sum2)-i-j);
		}
	}
	printf("%.4lf",(double)ans);
	cout << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 316 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 2 ms 340 KB Output is correct
14 Correct 2 ms 328 KB Output is correct
15 Correct 2 ms 340 KB Output is correct
16 Correct 2 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 316 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 2 ms 340 KB Output is correct
14 Correct 2 ms 328 KB Output is correct
15 Correct 2 ms 340 KB Output is correct
16 Correct 2 ms 364 KB Output is correct
17 Execution timed out 2069 ms 5020 KB Time limit exceeded
18 Halted 0 ms 0 KB -