# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
844597 | 2023-09-05T14:28:17 Z | vjudge1 | Sure Bet (CEOI17_sure) | C++17 | 92 ms | 6892 KB |
///***LTT***/// /// ->TUYEN QUOC GIA<- /// #include<bits/stdc++.h> //#pragma GCC optimize ("O3") //#pragma GCC optimize ("unroll-loops") //#pragma GCC target("popcnt") //#define int long long #define endl "\n" #define F first #define S second #define pb push_back #define CHECKBIT(mask,i) ((mask>>(i) )&1) // == 1 la bat, == 0 la tat #define OFFBIT(mask,i) ((1<<(i))^mask) // tat bit thu i #define ONBIT(mask,i) ((1<<(i))mask) // bat bit thu i using namespace std; const long long oo = 1e9+7; const int N = 2 * 1e5 + 10; long double a[N], b[N], ans, L, R; int n; bool cmp(long double a, long double b){ return a > b; } void inp(){ cin >> n; for (int i = 1;i <= n;i++){ cin >> a[i] >> b[i]; } return; } void solve(){ sort(a + 1,a + n + 1, cmp); sort(b + 1,b + n + 1, cmp); int l = 1, r = 1; while (l <= n or r <= n){ if ( (L < R and l <= n) or (r == n + 1) ){ L += a[l++]; } else R += b[r++]; --L; --R; ans = max(ans, min(L,R)); } cout << fixed << setprecision(4) << ans; return; } int main(){ ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL); if (fopen("file.inp", "r")){ freopen("file.inp", "r", stdin); freopen("file.out", "w", stdout); } //int t; //cin >> t; //while(t--){ inp(); solve(); //} }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 1 ms | 2396 KB | Output is correct |
4 | Correct | 1 ms | 2748 KB | Output is correct |
5 | Correct | 1 ms | 2396 KB | Output is correct |
6 | Correct | 1 ms | 2396 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 1 ms | 2396 KB | Output is correct |
4 | Correct | 1 ms | 2748 KB | Output is correct |
5 | Correct | 1 ms | 2396 KB | Output is correct |
6 | Correct | 1 ms | 2396 KB | Output is correct |
7 | Correct | 1 ms | 2396 KB | Output is correct |
8 | Correct | 1 ms | 2396 KB | Output is correct |
9 | Correct | 1 ms | 2396 KB | Output is correct |
10 | Correct | 1 ms | 2396 KB | Output is correct |
11 | Correct | 2 ms | 2392 KB | Output is correct |
12 | Correct | 1 ms | 2524 KB | Output is correct |
13 | Correct | 1 ms | 2392 KB | Output is correct |
14 | Correct | 1 ms | 2564 KB | Output is correct |
15 | Correct | 1 ms | 2396 KB | Output is correct |
16 | Correct | 1 ms | 2568 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 1 ms | 2396 KB | Output is correct |
4 | Correct | 1 ms | 2748 KB | Output is correct |
5 | Correct | 1 ms | 2396 KB | Output is correct |
6 | Correct | 1 ms | 2396 KB | Output is correct |
7 | Correct | 1 ms | 2396 KB | Output is correct |
8 | Correct | 1 ms | 2396 KB | Output is correct |
9 | Correct | 1 ms | 2396 KB | Output is correct |
10 | Correct | 1 ms | 2396 KB | Output is correct |
11 | Correct | 2 ms | 2392 KB | Output is correct |
12 | Correct | 1 ms | 2524 KB | Output is correct |
13 | Correct | 1 ms | 2392 KB | Output is correct |
14 | Correct | 1 ms | 2564 KB | Output is correct |
15 | Correct | 1 ms | 2396 KB | Output is correct |
16 | Correct | 1 ms | 2568 KB | Output is correct |
17 | Correct | 92 ms | 6768 KB | Output is correct |
18 | Correct | 90 ms | 6736 KB | Output is correct |
19 | Correct | 86 ms | 6264 KB | Output is correct |
20 | Correct | 89 ms | 6400 KB | Output is correct |
21 | Correct | 90 ms | 6768 KB | Output is correct |
22 | Correct | 84 ms | 6512 KB | Output is correct |
23 | Correct | 88 ms | 6512 KB | Output is correct |
24 | Correct | 88 ms | 6480 KB | Output is correct |
25 | Correct | 86 ms | 6520 KB | Output is correct |
26 | Correct | 90 ms | 6892 KB | Output is correct |