Submission #1282049

#TimeUsernameProblemLanguageResultExecution timeMemory
1282049nlsosadSure Bet (CEOI17_sure)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define f first #define s second using ld = long double; ld a[100001], b[100001]; signed main(){S int n; cin >> n; for (int i = 1;i<=n;++i){ cin >> a[i] >> b[i]; } ld res = 0; ld l = 0, r = 1e9; sort(a+1, a+n+1); sort(b+1, b+n+1); while(abs(l-r) >= 1e-6){ ld mid = (l+r)/2.0; ld s1 = 0, s2 = 0; int t1 = n, t2 = n; while(s1 < mid or s2 < mid){ bool check = false; while(s1 < mid and t1 >= 1){ s1 += a[t1]-1.0; check = true; s2 -= 1.0; t1--; } while(s2 < mid and t2>= 1){ s2 += b[t2]-1.0; s1 -= 1.0; check = true; t2--; } if(!check)break; } if(s1 >= mid and s2>=mid){ res = mid; l = mid; }else r = mid; } cout << fixed << setprecision(4) << res; }

Compilation message (stderr)

sure.cpp: In function 'int main()':
sure.cpp:8:15: error: 'S' was not declared in this scope
    8 | signed main(){S
      |               ^
sure.cpp:10:16: error: 'n' was not declared in this scope; did you mean 'yn'?
   10 |         cin >> n;
      |                ^
      |                yn