# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
136926 | dnass | Unija (COCI17_unija) | C++14 | 460 ms | 31032 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
컴파일 시 표준 에러 (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... |