Submission #847899

# Submission time Handle Problem Language Result Execution time Memory
847899 2023-09-10T18:57:49 Z vjudge1 Unija (COCI17_unija) C++17
10 / 100
565 ms 16212 KB
#include <bits/stdc++.h>
using namespace std;

int main()
{
    long long n,cnt=0;
    cin>>n;
    // int x[n],y[n];
    vector<pair<long long,long long>>v(n);
    for(int i=0 ; i<n ; i++)
    {
        long long xx,yy;
        cin>>xx>>yy;
        yy/=2;xx/=2;
        v[i]={xx,yy};
    }
    /*int mxxx=0,mxxy=0,mxyx=0,mxyy=0;
    for (int i=0 ; i<n ; i++)
    {
        if(x[i]>mxxx)
        {
            mxxx=x[i];
            mxxy=y[i];
        }
        if(x[i]==mxxx)
        {
            mxxy=max(mxxy,y[i]);
        }
        if(y[i]>mxyy)
        {
            mxyx=x[i];
            mxyy=y[i];
        }
        if(y[i]==mxyy)
        {
            mxyx=max(mxyx,x[i]);
        }
    }
    if(mxxx==mxyx && mxxy==mxyy)
    {
        cout<<mxxx*mxxy<<endl;
        return 0;
    }*/
    // cnt+=mxxx*mxxy;
    // mxyy-=mxxy;
    // cnt+=mxyy*mxyx;
    sort(v.begin(),v.end());
    /*for (int i=0 ; i<v.size()-1 ; i++)
    {
        if(v[i].first==v[i+1].first)
        {
            v.erase(v.begin()+i);
            i--;
        }
    }*/
    /*for (int i=1 ; i<v.size() ; i++)
    {
        if(v[i].second<v[i-1].second && v[i].first==v[i-1].first)
        {
            v.erase(v.begin()+i);
            i--;
        }
    }*/
    reverse(v.begin(),v.end());
    /*int j=0;
    for(int i=0 ; i<n ; i++)
    {
        cnt+=v[i].first*(v[i].second-j);
        // cout<<v[i].first<<" "<<v[i].second<<" "<<j<<" ";
        // cout<<cnt<<endl;
        j=v[i].second;
    }*/
    // int j=v[0].second,k=0,h=v[0].first;
    // int j=v[v.size()-1].second,k=v.size()-1;
    int j=0,k=0;
    cnt=0;
    // cout<<v[0].first<<" ";
    /*for (int i=0 ; i<n;  i++)
    {
        cout<<v[i].first<<" "<<v[i].second<<endl;
    }*/
    for(int i=v[0].first ; i>0 ; i--)
    {
        // cout<<v[j+1].first<<" ";
        if(i==v[k].first && v[k].second>v[j].second) j=k;
        if (i==v[k].first)k++;
        cnt+=v[j].second;
        // cnt+=v[i].second*(v[i].first-v[i-1].first);
        // cout<<cnt<<"\n";
        
    }
    cout<<cnt*4<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 565 ms 16084 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 860 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 49 ms 1884 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 153 ms 5132 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 538 ms 16212 KB Output isn't correct
2 Halted 0 ms 0 KB -