#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
1372 KB |
Output is correct |
2 |
Correct |
8 ms |
1372 KB |
Output is correct |
3 |
Correct |
8 ms |
1372 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
293 ms |
11344 KB |
Output is correct |
2 |
Correct |
297 ms |
11272 KB |
Output is correct |
3 |
Correct |
355 ms |
11280 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
49 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
172 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
600 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
47 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
46 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
95 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
139 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |