結果

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

ソースコード

diff #

#include <iostream>
#include <iomanip>//小数点出力用
//cout << fixed << setprecision(10) << ans;
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
using ll = long long;
using namespace std;
#define modPHash (ll)((1LL<<61)-1)
#define modP (ll)998244353
bool chkrng0idx(int pos, int sup) { return (0 <= pos && pos < sup); }
int clk4(int num) { return (num - 2) * (num % 2); }
void yn(bool tf) { cout << (tf ? "Yes\n" : "No\n"); }

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    string S[101], T[101];
    for (int i = 0;i < N;i++) {
        cin >> S[i] >> T[i];
    }
    bool ok = 1;
    for (int i = 0;i < N;i++) {
        bool sok = 1, tok = 1;
        for (int j = 0;j < N;j++) {
            if (i == j)continue;
            if (S[i] == S[j])sok = 0;
            if (S[i] == T[j])sok = 0;
        }
        for (int j = 0;j < N;j++) {
            if (i == j)continue;
            if (T[i] == S[j])tok = 0;
            if (T[i] == T[j])tok = 0;
        }
        if (sok == 0 && tok == 0)ok = 0;
    }
    yn(ok);
}
0