This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//
// main.cpp
// GeneralCompetitiveProgramming
//
// Created by Ali AlSalman on 12/07/2023.
//
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <numeric>
#include <cmath>
#include <climits>
#define endl '\n'
using namespace std;
int main() {
ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
int n;
cin>>n;
map<int, int> mp;
while (n--) {
int x, y;
cin>>x>>y;
x /= 2; y /= 2;
mp[x] = max(mp[x], y);
}
long long size = 0;
for (auto i = mp.rbegin(); i != mp.rend(); i++) {
if (next(i) == mp.rend()) {
size += (long long) i->first * i->second;
break;
}
size += (long long) (i->first - next(i)->first) * (i->second);
next(i)->second = max(next(i)->second, i->second);
}
cout<<4 * size<<endl;
}
# | 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... |