結果

問題 No.938 賢人を探せ
ユーザー 東前頭十一枚目東前頭十一枚目
提出日時 2019-12-12 11:06:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 34 ms / 2,000 ms
コード長 445 bytes
コンパイル時間 2,244 ms
コンパイル使用メモリ 174,152 KB
実行使用メモリ 7,808 KB
最終ジャッジ日時 2024-05-08 09:05:33
合計ジャッジ時間 3,477 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
7,808 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 19 ms
5,888 KB
testcase_09 AC 20 ms
5,888 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 28 ms
6,400 KB
testcase_12 AC 23 ms
6,016 KB
testcase_13 AC 24 ms
5,888 KB
testcase_14 AC 23 ms
6,016 KB
testcase_15 AC 24 ms
6,016 KB
testcase_16 AC 23 ms
5,888 KB
testcase_17 AC 23 ms
5,888 KB
testcase_18 AC 23 ms
6,016 KB
testcase_19 AC 25 ms
5,888 KB
testcase_20 AC 24 ms
5,888 KB
testcase_21 AC 23 ms
5,888 KB
testcase_22 AC 32 ms
7,808 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n; cin >> n;
	string a[n], b[n];
	set<string> A;
	for(int i = 0; i < n; ++i) {
		cin >> a[i] >> b[i];
		A.emplace(a[i]);
	}
	set<string> ans;
	for(int i = 0; i < n; ++i) {
		if(A.find(b[i]) == A.end()) {
			ans.emplace(b[i]);
		}
	}
	for(int i = 0; i < n; ++i) {
		auto itr = ans.find(b[i]);
		if(itr != ans.end()) {
			cout << b[i] << '\n';
			ans.erase(itr);
		}
	}
	return 0;
}
0