結果
| 問題 | No.938 賢人を探せ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-10-07 12:26:12 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 30 ms / 2,000 ms |
| コード長 | 623 bytes |
| 記録 | |
| コンパイル時間 | 2,456 ms |
| コンパイル使用メモリ | 219,860 KB |
| 最終ジャッジ日時 | 2025-02-07 22:34:51 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 21 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
int main(){
cin.tie(0);
ios::sync_with_stdio(0);
int N; cin >> N;
map<string,int> id;
set<string> st;
vector<string> ng(N);
int ID = 0;
rep(i,N) {
string a,b; cin >> a >> b;
if(!id.count(b)) id[b] = ID++;
ng[i] = a;
st.insert(b);
}
for(string &a : ng) st.erase(a);
vector<pair<int,string>> ans;
for(string s : st) ans.push_back({id[s], s});
sort(ans.begin(), ans.end());
for(auto [_, s] : ans) cout << s << "\n";
}