Submission #865571

#TimeUsernameProblemLanguageResultExecution timeMemory
865571vjudge1Sure Bet (CEOI17_sure)C++17
Compilation error
0 ms0 KiB
/// tree bends in youth /// 24 .10.2023 /// success is doing same thing in every single day!!! #include <bits/stdc++.h> #define ll long long #define pb push_back #define all(x) x.begin(), x.end() #define F first #define S second using namespace std; const ll N =2e5+ 5; const ll NN =2e6 + 5; const ll INF = -1e1; const ll MOD = 1e9 + 7; const ll LG = 18; const ll k = 316; int n; double a[N],b[N],pl[N],pr[N]; void solve(){ cin >> n; for(int i = 1;i <= n;i++){ cin >> a[i] >> b[i]; } sort(a + 1,a + n + 1); sort(b + 1,b + n + 1); reverse(a + 1,a+ n + 1); reverse(b + 1,b + n + 1); int z = 0,x = 0; for(int i = 1;i <= n;i++){ pr[i] = pr[i - 1] + b[i]; pl[i] = pl[i - 1] + a[i]; } double ans = 0; for(int i = 1;i <= 2 * n;i++){ for(int j = 0;j <=i;j++){ double sum = double(i) + double(j); double z = pr[i - j]; double x = pl[j]; ans = max(ans,min(z,x)-i); //if( i == 3 ) cout << z << " " << x << " " << j << " " << ans << '\n' ; } } cout << fixed << detprecision(4) << ans; } main (){ ios_base::sync_with_stdio(0); cin.tie(0); // freopen("input.txt","r",stdin); // freopen("output.txt","w",stdout); ll abd= 1; // cin >> abd; for(ll i = 1;i <= abd;i++){ // cout << "Case " << i << ":\n"; solve(); } }

Compilation message (stderr)

sure.cpp: In function 'void solve()':
sure.cpp:36:20: warning: unused variable 'sum' [-Wunused-variable]
   36 |             double sum = double(i) + double(j);
      |                    ^~~
sure.cpp:43:22: error: 'detprecision' was not declared in this scope
   43 |     cout << fixed << detprecision(4) << ans;
      |                      ^~~~~~~~~~~~
sure.cpp:28:9: warning: unused variable 'z' [-Wunused-variable]
   28 |     int z = 0,x = 0;
      |         ^
sure.cpp:28:15: warning: unused variable 'x' [-Wunused-variable]
   28 |     int z = 0,x = 0;
      |               ^
sure.cpp: At global scope:
sure.cpp:45:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   45 | main (){
      | ^~~~