From 892ccd3d0355647892da4ee267091cc32666dab3 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Sat, 14 May 2022 20:21:34 +0800 Subject: [PATCH] C - Poem Online Judge https://atcoder.jp/contests/abc251/submissions/31669538 --- AtCoder/ABC251/C/C.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 AtCoder/ABC251/C/C.cpp diff --git a/AtCoder/ABC251/C/C.cpp b/AtCoder/ABC251/C/C.cpp new file mode 100644 index 00000000..81605ed2 --- /dev/null +++ b/AtCoder/ABC251/C/C.cpp @@ -0,0 +1,33 @@ +#include +#include +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +int n; +std::string s; +std::unordered_map map; +std::pair ans; + +int main() { + std::ios::sync_with_stdio(false); + + cin >> n; + + for (int i = 1, x; i <= n; i++) { + cin >> s >> x; + + if (!map.count(s)) { + map[s] = true; + if (x > ans.first) { + ans = std::make_pair(x, i); + } + } + } + + cout << ans.second << endl; + + return 0; +}