페이지

10814번: 나이순 정렬

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


$O(n(\lg n+L))$


#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int n;
pair<intint> p[100000];
string s[100000];
int main() {
    cin >> n;
    for (int i = 0; i < n; i++) cin >> p[i].first >> s[i], p[i].second = i;
    sort(p, p + n);
    for (int i = 0; i < n; i++) cout << p[i].first << ' ' + s[p[i].second] << endl;
    return 0;
}

댓글 없음 :

댓글 쓰기