Submission #171914

#TimeUsernameProblemLanguageResultExecution timeMemory
171914dvdg6566Sure Bet (CEOI17_sure)C++14
0 / 100
2 ms256 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef vector<ld> vi; typedef pair<ld,ld> pi; typedef vector<pi> vpi; typedef long double ld; #define pb emplace_back #define mp make_pair #define lb lower_bound #define ub upper_bound #define ALL(x) x.begin(), x.end() #define SZ(x) (ll)x.size() #define f first #define s second #define MAXN 101010 vector<ld> A,B; ld a,b; int N; bool work(ld v){ ld x = v; ld y = v; int a = 0; int b = 0; while(x > 0 || y > 0){ ++x;++y; if (x > 0){ if (a==SZ(A))return 0; x -= A[a]; ++a; }else if (y > 0){ if (b==SZ(B))return 0; y -= B[b]; ++b; } } return 1; } int main(){ cin>>N; for (int i=1;i<=N;++i){ cin>>a>>b; if (a>1)A.pb(a); if (b>1)B.pb(b); } sort(ALL(A));reverse(ALL(A)); sort(ALL(B));reverse(ALL(B)); ld ub=100000000; ld lb=0; while (ub>lb+0.000001){ ld mid=(lb+ub)/2; if (work(mid))lb = mid; else ub = mid; } printf("%.5lf",lb); }

Compilation message (stderr)

sure.cpp: In function 'int main()':
sure.cpp:60:19: warning: format '%lf' expects argument of type 'double', but argument 2 has type 'ld {aka long double}' [-Wformat=]
  printf("%.5lf",lb);
                   ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...