Submission #878678

#TimeUsernameProblemLanguageResultExecution timeMemory
878678Sir_Ahmed_ImranSure Bet (CEOI17_sure)C++17
60 / 100
70 ms8716 KiB
///~~~LOTA~~~/// #include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define append push_back #define add insert #define nl '\n' #define ff first #define ss second #define panic break #define pii pair<int,int> #define pic pair<int,char> #define all(x) (x).begin(),(x).end() #define sum(a) accumulate(all(a),0) #define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL) #define terminator main #define N 2001 ld prex[N]; ld prey[N]; void solve(){ int n; ld o,p,q; cin>>n; vector<ld> x,y; for(int i=o=0;i<n;i++){ cin>>p>>q; x.append(p); y.append(q); } sort(all(x)); sort(all(y)); for(int i=0;i<N;i++) prex[i]=prey[i]=0; for(int i=n-1;i>=0;i--){ prex[n-i]=prex[n-i-1]+x[i]; prey[n-i]=prey[n-i-1]+y[i]; } for(int i=1;i<=2*n;i++) for(int j=0;j<=i;j++) o=max(o,min(prex[j],prey[i-j])-i); cout<<o; } int terminator(){ L0TA; cout<<fixed<<setprecision(4); solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...