Submission #22034109


Source Code Expand

/** author: samari06,  created: 24.04.2021 21:29:18 **/
#include <bits/stdc++.h>
#define REP(i, N) for(int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;

vector<vector<int>> g;
vector<int> ans(25, 10);

void dfs(int v){
    int nten = 0;
    //if(ans[v] != 10) return;
    REP(i,g[v].size()){
        if(ans[g[v][i]] != 10) nten++;
    }
    ans[v] = max(3-nten,0);
    REP(i,g[v].size()){
        if(ans[g[v][i]] == 10) dfs(g[v][i]);
    }

    return;
}

int main(){
    int n,m; cin >> n >> m;
    g.resize(n);
    REP(i,m){
        int a, b;
        cin >> a >> b;
        a--; b--;

        g[a].emplace_back(b);
        g[b].emplace_back(a);
    }

    vector<bool> f(n, true);
    //vector<int> ans(n, 10);
    REP(i,n){
        if(ans[i] == 10){
            dfs(i);
        }
    }
    

    ll res = 1;
    REP(i,n){
        res *= ans[i];
    }

    cout << res;
    return 0;
}

Submission Info

Submission Time
Task D - RGB Coloring 2
User samari06
Language C++ (GCC 9.2.1)
Score 0
Code Size 960 Byte
Status WA
Exec Time 7 ms
Memory 3616 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 4
AC × 37
WA × 11
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
All few_hen_00.txt, few_hen_01.txt, few_hen_02.txt, few_hen_03.txt, few_hen_04.txt, few_hen_05.txt, few_hen_06.txt, few_hen_07.txt, manual_00.txt, manual_01.txt, manual_02.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, tree_00.txt, tree_01.txt, tree_02.txt, tree_03.txt, tree_04.txt, tree_05.txt, tree_06.txt, tree_07.txt, tree_08.txt
Case Name Status Exec Time Memory
few_hen_00.txt AC 7 ms 3416 KiB
few_hen_01.txt AC 1 ms 3600 KiB
few_hen_02.txt AC 4 ms 3544 KiB
few_hen_03.txt AC 2 ms 3612 KiB
few_hen_04.txt AC 2 ms 3524 KiB
few_hen_05.txt WA 3 ms 3544 KiB
few_hen_06.txt AC 2 ms 3592 KiB
few_hen_07.txt AC 2 ms 3596 KiB
manual_00.txt AC 2 ms 3608 KiB
manual_01.txt AC 2 ms 3452 KiB
manual_02.txt AC 3 ms 3584 KiB
random_00.txt AC 2 ms 3612 KiB
random_01.txt WA 2 ms 3452 KiB
random_02.txt WA 2 ms 3588 KiB
random_03.txt AC 2 ms 3424 KiB
random_04.txt WA 2 ms 3584 KiB
random_05.txt WA 3 ms 3544 KiB
random_06.txt AC 2 ms 3408 KiB
random_07.txt AC 4 ms 3616 KiB
random_08.txt AC 2 ms 3500 KiB
random_09.txt AC 2 ms 3556 KiB
random_10.txt AC 2 ms 3488 KiB
random_11.txt AC 3 ms 3432 KiB
random_12.txt AC 2 ms 3452 KiB
random_13.txt AC 2 ms 3484 KiB
random_14.txt AC 2 ms 3600 KiB
random_15.txt AC 2 ms 3480 KiB
random_16.txt AC 2 ms 3596 KiB
random_17.txt WA 3 ms 3612 KiB
random_18.txt AC 2 ms 3488 KiB
random_19.txt WA 2 ms 3592 KiB
random_20.txt AC 3 ms 3488 KiB
random_21.txt WA 2 ms 3592 KiB
random_22.txt AC 2 ms 3612 KiB
random_23.txt WA 2 ms 3616 KiB
sample_01.txt AC 2 ms 3592 KiB
sample_02.txt AC 2 ms 3408 KiB
sample_03.txt AC 2 ms 3412 KiB
sample_04.txt AC 2 ms 3416 KiB
tree_00.txt AC 2 ms 3412 KiB
tree_01.txt WA 2 ms 3544 KiB
tree_02.txt WA 3 ms 3528 KiB
tree_03.txt AC 2 ms 3416 KiB
tree_04.txt AC 2 ms 3552 KiB
tree_05.txt AC 2 ms 3428 KiB
tree_06.txt AC 3 ms 3584 KiB
tree_07.txt AC 2 ms 3488 KiB
tree_08.txt AC 2 ms 3424 KiB