Submission #79338

# Submission time Handle Problem Language Result Execution time Memory
79338 2018-10-12T10:08:24 Z Saboon One-Way Streets (CEOI17_oneway) C++14
0 / 100
2 ms 376 KB
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <set>
#include <algorithm>
#include <iomanip>
#define F first
#define S second
#define PB push_back
#define PF push_front
#define MP make_pair
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
const int maxn = 1e5 + 10;
const int maxm = 1e5 + 10;
const int mod = 1e9 + 7;

ld p[maxn], q[maxn];

int main() {
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> p[i] >> q[i];

	sort (p + 1, p + n + 1, greater <ld> ());
	sort (q + 1, q + n + 1, greater <ld> ());

	ld ans = 0, fi = 0, se = 0;
	int idxse = 0;
	for (int idxfi = 1; idxfi <= n; idxfi ++) {
		fi += p[idxfi] - 1;
		se --;
		ans = max (ans, min (fi, se));
//		cout << idxfi << " " << idxse << " -> " << fi << " " << se << endl;
		while (se < fi and idxse < n) {
			idxse ++;
			se += q[idxse] - 1;
			fi --;
//			cout << idxfi << " " << idxse << " -> " << fi << " " << se << endl;
			ans = max (ans, min (fi, se));
		}
	}
	cout << fixed << setprecision (4) << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -