| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 599707 | f1nder | Pareto (COCI17_pareto) | C++17 | 46 ms | 2660 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
void solve();
int main()
{
ios_base::sync_with_stdio(false);cin.tie(NULL);
   
int t=1;
while(t--)
{
	solve();
	cout<<"\n";
}
//cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
return 0;
}
void solve()
{
    int n;cin>>n;
    std::vector<int> v(n),p(n) ;int sum=0;
    for (int i = 0; i < n; i++) {
        /* code */
        cin>>v[i];sum+=v[i];
    }
    sort(v.rbegin(),v.rend());
    double hi=0.0;double ai;
    p[0]=v[0];double h=(((v[0])*100.0)/sum);double a=(100.0)/n;
    for (int i = 1; i <= n; i++) {
        /* code */
        p[i]+=p[i-1]+v[i];
         hi=(p[i]*100.0)/sum;
        ai=((i+1)*100.0)/n;
        //cout<<" "<<h<<" "<<a;
        if((hi-ai)>(h-a)) {h=hi;a=ai;}
    }
    cout<<fixed<<setprecision(1)<<a<<"\n";
    cout<<setprecision(14);
    cout<<h;
    
}	
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
