Submission #848400

# Submission time Handle Problem Language Result Execution time Memory
848400 2023-09-12T12:25:21 Z vjudge1 Unija (COCI17_unija) C++17
100 / 100
571 ms 54544 KB
#include <bits/stdc++.h>
using namespace std;
int p[10000002]={};
int main()
{
    long long n,cnt=0;
    cin>>n;
    // vector<pair<long long,long long>>v(n);
    // map<int,int>p;

    for(int i=0 ; i<n ; i++)
    {
        long long x,y,z;
        cin>>x>>y;
        y/=2; x/=2;
        // v[i]={x,y};
        z=p[y];
        p[y]=max(z,x);
    }
    for(int i=10000000 ; i>0 ; i--) p[i]=max(p[i],p[i+1]);
    // for(auto i:p) cnt+=i.second;
    for(int i=0 ; i<10000001 ; i++)cnt+=p[i];
    cout<<cnt*4<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 56 ms 39476 KB Output is correct
2 Correct 54 ms 39504 KB Output is correct
3 Correct 54 ms 39512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 54 ms 39504 KB Output is correct
2 Correct 55 ms 39508 KB Output is correct
3 Correct 55 ms 39412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 54 ms 39508 KB Output is correct
2 Correct 54 ms 39412 KB Output is correct
3 Correct 54 ms 39504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 58 ms 39308 KB Output is correct
2 Correct 56 ms 39508 KB Output is correct
3 Correct 56 ms 39784 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 546 ms 39540 KB Output is correct
2 Correct 525 ms 54412 KB Output is correct
3 Correct 566 ms 54412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 54 ms 39508 KB Output is correct
2 Correct 53 ms 39508 KB Output is correct
3 Correct 53 ms 39388 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 69 ms 39508 KB Output is correct
2 Correct 66 ms 39852 KB Output is correct
3 Correct 68 ms 39752 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 94 ms 39548 KB Output is correct
2 Correct 105 ms 40772 KB Output is correct
3 Correct 95 ms 40864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 177 ms 39508 KB Output is correct
2 Correct 178 ms 43572 KB Output is correct
3 Correct 179 ms 43608 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 568 ms 39508 KB Output is correct
2 Correct 560 ms 54408 KB Output is correct
3 Correct 571 ms 54544 KB Output is correct