結果

問題 No.1640 簡単な色塗り
ユーザー bit_kyoprobit_kyopro
提出日時 2021-08-06 22:32:42
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,269 bytes
コンパイル時間 1,678 ms
コンパイル使用メモリ 168,864 KB
実行使用メモリ 4,924 KB
最終ジャッジ日時 2023-09-12 02:32:31
合計ジャッジ時間 9,663 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 184 ms
4,856 KB
testcase_05 AC 187 ms
4,864 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 2 ms
4,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 9 ms
4,376 KB
testcase_31 AC 56 ms
4,892 KB
testcase_32 AC 49 ms
4,720 KB
testcase_33 AC 33 ms
4,376 KB
testcase_34 AC 41 ms
4,564 KB
testcase_35 AC 34 ms
4,380 KB
testcase_36 AC 9 ms
4,380 KB
testcase_37 AC 12 ms
4,380 KB
testcase_38 AC 50 ms
4,760 KB
testcase_39 AC 22 ms
4,376 KB
testcase_40 AC 22 ms
4,380 KB
testcase_41 AC 43 ms
4,644 KB
testcase_42 AC 26 ms
4,380 KB
testcase_43 AC 26 ms
4,384 KB
testcase_44 AC 26 ms
4,380 KB
testcase_45 AC 20 ms
4,380 KB
testcase_46 AC 10 ms
4,380 KB
testcase_47 AC 7 ms
4,376 KB
testcase_48 AC 52 ms
4,916 KB
testcase_49 AC 4 ms
4,380 KB
testcase_50 AC 2 ms
4,376 KB
testcase_51 AC 1 ms
4,380 KB
testcase_52 WA -
testcase_53 WA -
07_evil_01.txt WA -
07_evil_02.txt WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
const long long MOD = 1000000007;
const long double PI = 3.14159265358979;
const long long INF = 1LL<<60;
template <typename T> bool chmax(T &a, const T& b){if(a < b){a = b;return true;}return false;}
template <typename T> bool chmin(T &a, const T& b){if(a > b){a = b;return true;}return false;}
bool is_prime(long long N){if(N==1) return false;for(long long i=2; i*i <= N; i++){if(N%i==0)return false;}return true;}
long long gcd(long long a, long long b){if (b == 0) return a;else return gcd(b, a % b);}
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
#define int long long


int32_t main(){
    int N;
    cin >> N;
    vector<int> ans, nurinuri(N,0);
    for(int i=0; i<N; i++){
        int a,b; cin >> a >> b;
        a--; b--;
        if(!nurinuri[a]){
            nurinuri[a]=1;
            ans.push_back(a);
        }else{
            nurinuri[b] = 1;
            ans.push_back(b);
        }
    }
    for(int i=0; i<N; i++){
        if(!nurinuri[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    for(int i=0; i<N; i++){
        cout << ans[i]+1 << endl;
    }
}
0