結果
問題 |
No.938 賢人を探せ
|
ユーザー |
![]() |
提出日時 | 2019-12-01 12:07:04 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 65 ms / 2,000 ms |
コード長 | 547 bytes |
コンパイル時間 | 2,093 ms |
コンパイル使用メモリ | 181,976 KB |
実行使用メモリ | 7,892 KB |
最終ジャッジ日時 | 2024-12-14 11:43:30 |
合計ジャッジ時間 | 3,412 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i = 0; i < (n);i++) #define sz(x) int(x.size()) typedef long long ll; typedef pair<int,int> P; int main(){ int n; cin >> n; map<string, int> mp; vector<pair<string,string>> p; rep(i,n) { string a, b; cin >> a >> b; mp[a] = 1; if (!mp.count(b)) mp[b] = 0; pair<string,string> x = make_pair(a,b); p.emplace_back(x); } rep(i,n) { if (mp[p[i].second]) continue; cout << p[i].second << endl; mp[p[i].second]++; } return 0; }