1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| #include <iostream> #include <algorithm> #include <vector> using namespace std; int main() { int n, x, y; vector<pair<int, int> > answer; cin >> n; for(int i = 0; i < n; ++i) { cin >> x >> y; answer.push_back(make_pair(x, y)); } sort(answer.begin(), answer.end()); for(auto ans : answer) { cout << ans.first << " " << ans.second << '\n'; } return 0; }
|