結果
| 問題 | No.3196 Unique Nickname | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2025-08-14 18:12:28 | 
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 705 bytes | 
| コンパイル時間 | 766 ms | 
| コンパイル使用メモリ | 81,728 KB | 
| 実行使用メモリ | 6,272 KB | 
| 最終ジャッジ日時 | 2025-08-14 18:12:30 | 
| 合計ジャッジ時間 | 1,862 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 20 | 
ソースコード
#include <iostream>
#include <string>
using namespace std;
int main() {
    int n;
    cin >> n;
    string s[n], t[n];
    for (int i = 0; i < n; i++) {
        cin >> s[i] >> t[i];
    }
    bool ans = true;
    for (int i = 0; i < n; i++) {
        bool fs = true, ft = true;
        for (int j = 0; j < n; j++) {
            if (i == j) {
                continue;
            }
            if (s[i] == s[j] || s[i] == t[j]) {
                fs = false;
            }
            if (t[i] == s[j] || t[i] == t[j]) {
                ft = false;
            }
        }
        if (!fs && !ft) {
            ans = false;
        }
    }
    cout << (ans ? "Yes" : "No") << endl;
    return 0;
}
            
            
            
        