답안 #380034

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
380034 2021-03-20T05:18:55 Z nextgenxing Sure Bet (CEOI17_sure) C++14
60 / 100
2000 ms 4972 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define f first
#define s second
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define F0R(i, x) FOR(i, 0, x)
#define FORd(i, a, b) for(int i = (b)-1; i >= (a); i--)
#define F0Rd(i, x) FORd(i, 0, x)
#define ckif(a, b, c) ((c) ? (a) : (b))
const int MAX_N = 100001;
const ll MOD = 1000000007;
const ll INF = 1e18;

int n;
double a[MAX_N], b[MAX_N], pa[MAX_N], pb[MAX_N];

int main(int argc, const char * argv[]){
    ios_base::sync_with_stdio(0), cin.tie(0);
    cin >> n;
    F0R(i, n) cin >> a[i] >> b[i];
    sort(a, a+n), sort(b, b+n);
    reverse(a, a+n), reverse(b, b+n);
    pa[0] = a[0], pb[0] = b[0];
    FOR(i, 1, n) pa[i] = pa[i-1]+a[i], pb[i] = pb[i-1]+b[i];
    double ans = 0;
    F0R(i, n) F0R(j, n){
        ans = max(ans, min(pa[i]-double(i+j+2), pb[j]-double(i+j+2)));
    }
    cout << fixed << setprecision(4) << ans << endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 3 ms 364 KB Output is correct
13 Correct 3 ms 384 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 3 ms 364 KB Output is correct
16 Correct 3 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 3 ms 364 KB Output is correct
13 Correct 3 ms 384 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 3 ms 364 KB Output is correct
16 Correct 3 ms 364 KB Output is correct
17 Execution timed out 2088 ms 4972 KB Time limit exceeded
18 Halted 0 ms 0 KB -