Submission #24000

#TimeUsernameProblemLanguageResultExecution timeMemory
24000TrathzPareto (COCI17_pareto)C++98
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define F first #define S second #define int long long #define mp make_pair #define pb push_back #define pii pair<int, int> #define ieps (int) 1e5 + 800 #define eps (int) 1e9 #define jmp exit(0) double pct(int x , int y){ return 1.0*x/y; } int32_t main(){ int n ; cin>>n; vector<int> v(n); int s = 0; for(int i = 0;i<n;i++) cin>>v[i] , s+=v[i]; sort(v.rbegin() , v.rend()); int atual = 0; pair<double , double > tot = {0, 0}; for(int i = 0;i<n;i++){ atual+=v[i]; pair<double , double > l = {pct(i + 1 , n) , pct(atual,s)}; if(l.S - l.F> tot.S - tot.F){ tot = l; } } cout<<fixed<<setprecision(9)<<tot.F*100.00<<endl<<tot.S*100.00; }

Compilation message (stderr)

pareto.cpp: In function 'int32_t main()':
pareto.cpp:27:39: error: in C++98 'tot' must be initialized by constructor, not by '{...}'
     pair<double , double > tot = {0, 0};
                                       ^
pareto.cpp:30:66: error: in C++98 'l' must be initialized by constructor, not by '{...}'
         pair<double , double > l = {pct(i + 1 , n) , pct(atual,s)};
                                                                  ^