結果

問題 No.3196 Unique Nickname
ユーザー ruase_
提出日時 2025-08-14 19:59:39
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 612 bytes
コンパイル時間 886 ms
コンパイル使用メモリ 96,360 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-08-14 19:59:41
合計ジャッジ時間 1,847 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;

int main() {
	int n;
	cin >> n;
	string a[n][2];

	for(int i = 0; i < n; i++) cin>> a[i][0] >> a[i][1];

	

	bool t1_flg = false;
	bool t2_flg = false;
	
	for(int b = 0; b < n ; b++){
		string t1 = a[b][0];
		string t2 = a[b][1];
		for(int i = b + 1 ; i < n ; i++)
		{
			if(t1 == a[i][0] || t1 == a[i][1])
			{
				t1_flg = true;
			}
			if(t2 == a[i][0] || t2 == a[i][1])
			{
				t2_flg = true;
			}
		}
		if (t1_flg && t2_flg)
		{
			break;
		}
	}
	
	
	if (t1_flg && t2_flg)
	{
		cout << "No" << endl;
	}
	else
	{
		cout << "Yes" << endl;
	}

}
0