結果

問題 No.938 賢人を探せ
ユーザー 東前頭十一枚目東前頭十一枚目
提出日時 2019-12-12 11:06:04
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 445 bytes
コンパイル時間 1,590 ms
コンパイル使用メモリ 173,132 KB
実行使用メモリ 7,772 KB
最終ジャッジ日時 2023-08-21 03:37:36
合計ジャッジ時間 3,022 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
7,772 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 16 ms
5,736 KB
testcase_09 AC 19 ms
5,884 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 23 ms
6,220 KB
testcase_12 AC 19 ms
5,740 KB
testcase_13 AC 19 ms
5,796 KB
testcase_14 AC 19 ms
5,748 KB
testcase_15 AC 19 ms
5,748 KB
testcase_16 AC 19 ms
5,680 KB
testcase_17 AC 19 ms
5,708 KB
testcase_18 AC 19 ms
5,704 KB
testcase_19 AC 19 ms
5,688 KB
testcase_20 AC 20 ms
5,752 KB
testcase_21 AC 20 ms
5,708 KB
testcase_22 AC 27 ms
7,744 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