# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
170534 | mdn2002 | Unija (COCI17_unija) | C++14 | 1002 ms | 65540 KiB |
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;
const long long mod=998244353;
multiset<int>ms;
int n,k;
vector<int>v[1000006];
map<int,int>m;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
//freopen("lemonade.in","r",stdin);
//freopen("lemonade.out","w",stdout);
cin>>n;
for(int i=0;i<n;i++)
{
int x,y;
cin>>x>>y;
x/=2;
y/=2;
if(m[y+1]==0)m[y+1]=++k;
ms.insert(x);
v[m[y+1]].push_back(x);
}
long long ans=0;
for(int i=1;i<=10000000;i++)
{
for(int j=0;j<v[m[i]].size();j++)
{
ms.erase(ms.find(v[m[i]][j]));
}
if(ms.size()==0)break;
ans+=*--ms.end();
}
cout<<ans*4;
}
Compilation message (stderr)
# | 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... |