답안 #850334

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
850334 2023-09-16T11:52:45 Z vjudge1 Unija (COCI17_unija) C++17
80 / 100
1000 ms 50376 KB
//
//  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;
    for (int i = 0; i < n; i++) {
        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;
        if (i->second > next(i)->second) next(i)->second = i->second;
    }
    cout<<size * 4<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 600 KB Output is correct
2 Correct 2 ms 600 KB Output is correct
3 Correct 3 ms 572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 948 ms 50376 KB Output is correct
2 Execution timed out 1026 ms 49920 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 1624 KB Output is correct
2 Correct 12 ms 1624 KB Output is correct
3 Correct 12 ms 1880 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 47 ms 5200 KB Output is correct
2 Correct 46 ms 5200 KB Output is correct
3 Correct 47 ms 5200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 170 ms 15184 KB Output is correct
2 Correct 172 ms 14872 KB Output is correct
3 Correct 176 ms 14928 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1032 ms 50000 KB Time limit exceeded
2 Halted 0 ms 0 KB -