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;
bool rule(pair<int, int>a, pair<int, int>b)
{
return a.first*a.second<b.first*b.second;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin>>n;
int maxX=-1, maxY=-1;
vector<pair<int, int>>V;
for(int i=0;i<n;i++)
{
int X, Y;
cin>>X>>Y;
X/=2;
Y/=2;
V.push_back({X, Y});
maxX=max(maxX, X);
maxY=max(maxY, Y);
}
int P[maxX][maxY];
memset(P, 0, sizeof(P));
sort(V.begin(), V.end(), rule);
int res=0;
for(int i=0;i<n;i++)
{
if(V[i].first<V[n-1].first && V[i].second<V[n-1].second)
{
continue;
}
else
{
for(int j=0;j<V[i].first;j++)
{
for(int k=0;k<V[i].second;k++)
{
if(P[j][k]==0)
{
P[j][k]=1;
res++;
}
}
}
}
}
cout<<res*4<<'\n';
return 0;
}
# | 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... |