Submission #26021

# Submission time Handle Problem Language Result Execution time Memory
26021 2017-06-26T14:32:50 Z iletavcioski Unija (COCI17_unija) C++14
30 / 100
869 ms 26796 KB
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<iomanip>
using namespace std;
typedef  double ll;
int main()
{
    ios_base::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<pair<ll,ll> >v;
    for(int i=0;i<n;i++)
    {
        ll a,b;
        cin>>a>>b;
        b/=2;
        v.push_back(make_pair(a,b));
    }
    sort(v.begin(),v.end());
    reverse(v.begin(),v.end());
    int i=0;
    ll maxi=0;
    ll prethoden=0;
    ll brojac=0;
    while(i<n)
    {
        if(v[i].second>maxi)
        {
            brojac+=((v[i].second-maxi)*v[i].first);
            maxi=v[i].second;
                
        }
        i++;
    }
    brojac*=2;
    cout<<brojac<<endl;
    return 0;
}

Compilation message

unija.cpp: In function 'int main()':
unija.cpp:25:8: warning: unused variable 'prethoden' [-Wunused-variable]
     ll prethoden=0;
        ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2180 KB Output is correct
2 Correct 0 ms 2180 KB Output is correct
3 Correct 0 ms 2180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2180 KB Output is correct
2 Correct 0 ms 2180 KB Output is correct
3 Correct 0 ms 2180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2180 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 2340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 823 ms 26796 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2180 KB Output is correct
2 Correct 0 ms 2180 KB Output is correct
3 Correct 0 ms 2180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 2988 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 89 ms 5292 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 236 ms 14508 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 869 ms 26796 KB Output isn't correct
2 Halted 0 ms 0 KB -