# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
136926 | dnass | Unija (COCI17_unija) | C++14 | 460 ms | 31032 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;
typedef long long int lld;
lld n;
pair<lld, lld> rectangles[1000100];
bool comp(pair<lld, lld> lhs, pair<lld, lld> rhs){
if(rhs.second==lhs.second) return lhs.first<rhs.first;
return lhs.second>rhs.second;
}
int main(){
scanf("%lld", &n);
for(lld i=0;i<n;i++){
scanf("%lld %lld", &rectangles[i].first, &rectangles[i].second);
rectangles[i].first/=2; rectangles[i].second/=2;
}
sort(rectangles, rectangles+n, comp);
lld area = 0;
lld mx_height = 0;
lld nexty;
for(lld i=1;i<=n;i++){
if(i==n||rectangles[i].second!=rectangles[i-1].second){
if(i==n) nexty = 0;
else nexty = rectangles[i].second;
mx_height = max(mx_height, rectangles[i-1].first);
area += mx_height*(rectangles[i-1].second-nexty);
}
}
printf("%lld\n", 4*area);
return 0;
}
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... |