結果

問題 No.938 賢人を探せ
ユーザー ohreitetsuohreitetsu
提出日時 2019-12-06 21:11:08
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 625 bytes
コンパイル時間 694 ms
コンパイル使用メモリ 74,616 KB
実行使用メモリ 14,360 KB
最終ジャッジ日時 2023-08-25 13:01:25
合計ジャッジ時間 8,247 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(int argc, char* argv[])
{
	int N,i,j;
	cin>>N;
	vector<string> AB;
	vector<int> flag;
	string A,B;
	for (i=0;i<N;i++){
		cin>>A>>B;
		bool bFindA=false;
		bool bFindB=false;
		for (j=0;j<AB.size();j++){
			if (!AB[j].compare(A)){
				flag[j]=1;
				bFindA=true;
			}
			if (!AB[j].compare(B)){
				bFindB=true;
			}
		}
		if (!bFindA){
			AB.push_back(A);
			flag.push_back(1);
		}
		if (!bFindB){				
			AB.push_back(B);
			flag.push_back(0);
		}
	}
	for (i=0;i<AB.size();i++){
		if (flag[i]==0){
			cout<<AB[i]<<endl;
		}
	}
	return 0;
}
0