BOJ : https://www.acmicpc.net/problem/10814

 

pair 를 통하여 구현하였다.

 

더보기
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
 
pair<pair<int,int>string> pii[100001];
 
 
int main() {
    ios::sync_with_stdio(false);
    int N; cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> pii[i].first.first >> pii[i].second;
        pii[i].first.second = i;
    }
 
    sort(pii, pii + N);
    for (int i = 0; i < N; i++cout << pii[i].first.first << ' ' << pii[i].second << '\n';
    return 0;
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter

'algorithm > BOJ' 카테고리의 다른 글

BOJ 10989번 수 정렬하기 3  (0) 2020.01.10
BOJ 10825번 국영수  (0) 2020.01.10
BOJ 11651번 좌표 정렬하기2  (0) 2020.01.10
BOJ 11650번 좌표 정렬하기  (0) 2020.01.10
BOJ 2751번 수 정렬하기2  (0) 2020.01.10

+ Recent posts