Submission #617092

# Submission time Handle Problem Language Result Execution time Memory
617092 2022-08-01T08:39:48 Z cfalas Sure Bet (CEOI17_sure) C++17
60 / 100
2000 ms 3148 KB
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second

#define ll long long
#define FORi(i,a,b) for(ll i=a;i<(ll)b;i++)
#define FOR(i,n) FORi(i,0,n)
#define FOA(v,a) for(auto v : a)

int main(){
	int n;
	cin>>n;
	vector<double> a(n), b(n);
	FOR(i,n) cin>>a[i]>>b[i];
	sort(a.begin(), a.end(), [](double a, double b){return a>b;});
	sort(b.begin(), b.end(), [](double a, double b){return a>b;});

	double ans=0;
	double sa=0;
	FOR(i,n){
		sa+=a[i];
		double sj=0;
		FOR(j,n){
			sj+=b[j];
			ans = max(ans, min(sj-(i+j+2), sa-(i+j+2)));
		}
	}
	cout<<fixed<<setprecision(4)<<ans<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 300 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 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 300 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 296 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 300 KB Output is correct
12 Correct 5 ms 332 KB Output is correct
13 Correct 5 ms 212 KB Output is correct
14 Correct 5 ms 212 KB Output is correct
15 Correct 4 ms 212 KB Output is correct
16 Correct 5 ms 368 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 300 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 296 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 300 KB Output is correct
12 Correct 5 ms 332 KB Output is correct
13 Correct 5 ms 212 KB Output is correct
14 Correct 5 ms 212 KB Output is correct
15 Correct 4 ms 212 KB Output is correct
16 Correct 5 ms 368 KB Output is correct
17 Execution timed out 2092 ms 3148 KB Time limit exceeded
18 Halted 0 ms 0 KB -