AT_abc348_c 题解

· · 题解

思路

# 代码 ```cpp # include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair <int, int> pii; int n, x, y, maxx; map <int, int> f; int main () { ios::sync_with_stdio (0); cin.tie (0); cout.tie (0); cin >> n; for (int i = 0; i < n; ++ i) { cin >> x >> y; if (! f[y] || x < f[y]) f[y] = x; } for (auto i = f.begin (); i != f.end (); ++ i) //map 独特的遍历方式,其中 auto 可以替换为 map <int, int> :: iterator,i->first 表示第一位(下标),i->second 表示第二维(数值) maxx = max (maxx, i->second); cout << maxx; return 0; } ```