답안 #35070

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
35070 2017-11-17T22:15:43 Z model_code Sure Bet (CEOI17_sure) C++11
100 / 100
189 ms 3576 KB
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <math.h>
#include <queue>
#include <list>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <ctime>
using namespace std;

#define ALL(c) (c).begin(),(c).end()
#define IN(x,c) (find(c.begin(),c.end(),x) != (c).end())
#define REP(i,n) for (int i=0;i<(int)(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
#define INIT(a,v) memset(a,v,sizeof(a))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
template<class A, class B> A cvt(B x) { stringstream ss; ss<<x; A y; ss>>y; return y; }

typedef pair<int,int> PII;
typedef long long int64;

int n=0;
double a[100000],b[100000];

int main() {
	cin >> n;
	REP (i,n) {
		cin >> a[i] >> b[i];
		a[i]-=1; b[i]-=1;
	}
	sort(a,a+n); reverse(a,a+n);
	sort(b,b+n); reverse(b,b+n);
	int i=0,j=0;
	double r=0;
	double sa=0,sb=0;
	while (i<n) {
		sa+=a[i];
		i++;
		while (j<n && min(sa-j,sb-i)<min(sa-(j+1),(sb+b[j])-i)) {
			sb+=b[j];
			j++;
		}
		r=max(r, min(sa-j,sb-i));
	}
	printf("%.4f\n",r);
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3576 KB Output is correct
2 Correct 0 ms 3576 KB Output is correct
3 Correct 0 ms 3576 KB Output is correct
4 Correct 0 ms 3576 KB Output is correct
5 Correct 0 ms 3576 KB Output is correct
6 Correct 0 ms 3576 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3576 KB Output is correct
2 Correct 0 ms 3576 KB Output is correct
3 Correct 0 ms 3576 KB Output is correct
4 Correct 0 ms 3576 KB Output is correct
5 Correct 0 ms 3576 KB Output is correct
6 Correct 0 ms 3576 KB Output is correct
7 Correct 0 ms 3576 KB Output is correct
8 Correct 0 ms 3576 KB Output is correct
9 Correct 0 ms 3576 KB Output is correct
10 Correct 0 ms 3576 KB Output is correct
11 Correct 0 ms 3576 KB Output is correct
12 Correct 0 ms 3576 KB Output is correct
13 Correct 0 ms 3576 KB Output is correct
14 Correct 0 ms 3576 KB Output is correct
15 Correct 0 ms 3576 KB Output is correct
16 Correct 0 ms 3576 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3576 KB Output is correct
2 Correct 0 ms 3576 KB Output is correct
3 Correct 0 ms 3576 KB Output is correct
4 Correct 0 ms 3576 KB Output is correct
5 Correct 0 ms 3576 KB Output is correct
6 Correct 0 ms 3576 KB Output is correct
7 Correct 0 ms 3576 KB Output is correct
8 Correct 0 ms 3576 KB Output is correct
9 Correct 0 ms 3576 KB Output is correct
10 Correct 0 ms 3576 KB Output is correct
11 Correct 0 ms 3576 KB Output is correct
12 Correct 0 ms 3576 KB Output is correct
13 Correct 0 ms 3576 KB Output is correct
14 Correct 0 ms 3576 KB Output is correct
15 Correct 0 ms 3576 KB Output is correct
16 Correct 0 ms 3576 KB Output is correct
17 Correct 156 ms 3576 KB Output is correct
18 Correct 156 ms 3576 KB Output is correct
19 Correct 153 ms 3576 KB Output is correct
20 Correct 156 ms 3576 KB Output is correct
21 Correct 176 ms 3576 KB Output is correct
22 Correct 163 ms 3576 KB Output is correct
23 Correct 163 ms 3576 KB Output is correct
24 Correct 159 ms 3576 KB Output is correct
25 Correct 169 ms 3576 KB Output is correct
26 Correct 189 ms 3576 KB Output is correct