結果

問題 No.3196 Unique Nickname
ユーザー karinohito
提出日時 2025-07-11 21:22:43
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 530 bytes
コンパイル時間 3,350 ms
コンパイル使用メモリ 286,280 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-07-11 21:22:51
合計ジャッジ時間 3,595 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

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

using ll =long long;
void solve(){
    map<string,ll> M;
    ll N;
    cin>>N;
    vector<string> S(N),T(N);
    for(int i=0;i<N;i++){
        cin>>S[i]>>T[i];
        M[S[i]]++;
        M[T[i]]++;
    }
    bool OK=1;
    for(int i=0;i<N;i++){
        if(M[S[i]]>1&&M[T[i]]>1){
            cout<<"No\n";
            return;
        }
    }
    cout<<"Yes\n";
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int T=1;
    // cin>>T;
    while(T--)solve();
}
0