This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long n,cnt=0;
cin>>n;
// vector<pair<long long,long long>>v(n);
// map<int,int>p;
long long p[10000001]={};
for(int i=0 ; i<n ; i++)
{
long long x,y;
cin>>x>>y;
y/=2; x/=2;
// v[i]={x,y};
p[y]=max(p[y],x);
}
for(int i=10000001-1 ; 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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |