結果

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

ソースコード

diff #

//https://atcoder.jp/contests/adt_all_20250109_2/submissions/61497078より.

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (ll)(n); i++)
#define all(a) (a).begin(), (a).end()
using ll = long long;
const int INF32 = 2e9;
const ll INF64 = 4e18;

int main() {
    int N;
    cin >> N;
    vector<pair<string, string>> st(N);
    map<string, int> list;
    rep(i, N) {
        string si, ti;
        cin >> si >> ti;
        st[i] = make_pair(si, ti);
        if (list.count(si)) {
            list[si]++;
        } else
            list[si] = 0;
        if (si == ti)
            continue;
        if (list.count(ti)) {
            list[ti]++;
        } else
            list[ti] = 0;
    }
    bool ans = true;
    rep(i, N) {
        if (list[st[i].first] > 0 && list[st[i].second])
            ans = false;
    }
    if (ans)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}
0