답안 #100734

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
100734 2019-03-13T19:43:11 Z dalgerok Unija (COCI17_unija) C++17
100 / 100
407 ms 28584 KB
#include<bits/stdc++.h>
using namespace std;



const int N = 1e7 + 5;



int n, x, y, a[N];



int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> x >> y;
        a[x] = max(a[x], y);
    }
    long long ans = 0;
    int mx = 0;
    for(int i = 1e7; i >= 1; i--){
        mx = max(mx, a[i]);
        ans += mx;
    }
    cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 384 KB Output is correct
2 Correct 20 ms 384 KB Output is correct
3 Correct 21 ms 512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 384 KB Output is correct
2 Correct 20 ms 384 KB Output is correct
3 Correct 19 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 384 KB Output is correct
2 Correct 21 ms 484 KB Output is correct
3 Correct 20 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 512 KB Output is correct
2 Correct 20 ms 512 KB Output is correct
3 Correct 22 ms 640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 407 ms 28568 KB Output is correct
2 Correct 366 ms 28536 KB Output is correct
3 Correct 362 ms 28536 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 384 KB Output is correct
2 Correct 20 ms 452 KB Output is correct
3 Correct 24 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 1152 KB Output is correct
2 Correct 28 ms 1124 KB Output is correct
3 Correct 33 ms 1152 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 60 ms 3100 KB Output is correct
2 Correct 48 ms 3064 KB Output is correct
3 Correct 55 ms 3064 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 107 ms 8312 KB Output is correct
2 Correct 104 ms 8528 KB Output is correct
3 Correct 99 ms 8440 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 344 ms 28576 KB Output is correct
2 Correct 397 ms 28584 KB Output is correct
3 Correct 388 ms 28552 KB Output is correct