제출 #851812

#제출 시각아이디문제언어결과실행 시간메모리
851812AliMark71Unija (COCI17_unija)C++17
80 / 100
1042 ms50564 KiB
// // 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...