AtCoder Grand Contest 012

Submission #1199243

Source codeソースコード

#include <iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
const ll MOD = 1000000007;

    ll N,C,M,K,temp,ans=0;
    ll Q,query[100010][3];
    vector<ll> T;
    bool fir=true,go=false;
    vector<int> g[100010];
    int flag[100010];
    int a[100010]={0};

void  dfs(int v,int dis,int color){
    if(flag[v]>=dis||dis<0)return;
    if(!a[v])a[v]=color;

    flag[v]=dis;
    for(auto x:g[v]){
            dfs(x,dis-1,color);
    }

}


int main() {
    ios_base::sync_with_stdio(false);
    for(int i = 0; i < 100010; i++) flag[i] = -10;
    cin>>N>>M;
    REP(i,M){
        cin>>C>>K;
        g[C].push_back(K);
        g[K].push_back(C);
    }
    cin>>Q;
    REP(i,Q){
        cin>>query[i][0]>>query[i][1]>>query[i][2];
    }
    for(int i=Q-1;i>=0;i--){
        dfs(query[i][0],query[i][1],query[i][2]);
    }
    EREP(i,N){
        cout<<a[i]<<endl;
    }
    return 0;
}

Submission

Task問題 B - Splatter Painting
User nameユーザ名 Nafmo
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 AC
Score得点 700
Source lengthソースコード長 1194 Byte
File nameファイル名
Exec time実行時間 231 ms
Memory usageメモリ使用量 9592 KB

Test case

Set

Set name Score得点 / Max score Cases
Sample - 00_example_01.txt,00_example_02.txt
Subtask1 200 / 200 00_example_01.txt,00_example_02.txt,10_01.txt,10_02.txt,10_03.txt,10_04.txt,10_05.txt,10_06.txt,10_07.txt,10_08.txt,10_09.txt,10_10.txt,10_11.txt,10_12.txt,10_13.txt,10_14.txt,10_15.txt,10_16.txt,10_17.txt
All 500 / 500 00_example_01.txt,00_example_02.txt,10_01.txt,10_02.txt,10_03.txt,10_04.txt,10_05.txt,10_06.txt,10_07.txt,10_08.txt,10_09.txt,10_10.txt,10_11.txt,10_12.txt,10_13.txt,10_14.txt,10_15.txt,10_16.txt,10_17.txt,20_01.txt,20_02.txt,20_03.txt,20_04.txt,20_05.txt,20_06.txt,20_07.txt,20_08.txt,20_09.txt,20_10.txt,20_11.txt,20_12.txt,20_13.txt,20_14.txt,20_15.txt,20_16.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
00_example_01.txt AC 3 ms 3968 KB
00_example_02.txt AC 3 ms 3968 KB
10_01.txt AC 3 ms 3968 KB
10_02.txt AC 3 ms 3968 KB
10_03.txt AC 3 ms 3968 KB
10_04.txt AC 3 ms 3968 KB
10_05.txt AC 3 ms 3968 KB
10_06.txt AC 3 ms 3968 KB
10_07.txt AC 5 ms 3968 KB
10_08.txt AC 7 ms 4096 KB
10_09.txt AC 7 ms 4096 KB
10_10.txt AC 7 ms 4096 KB
10_11.txt AC 7 ms 4096 KB
10_12.txt AC 7 ms 4096 KB
10_13.txt AC 6 ms 4096 KB
10_14.txt AC 6 ms 4096 KB
10_15.txt AC 6 ms 4096 KB
10_16.txt AC 7 ms 4096 KB
10_17.txt AC 7 ms 4096 KB
20_01.txt AC 229 ms 8960 KB
20_02.txt AC 231 ms 8960 KB
20_03.txt AC 230 ms 8832 KB
20_04.txt AC 26 ms 4736 KB
20_05.txt AC 5 ms 3968 KB
20_06.txt AC 146 ms 4608 KB
20_07.txt AC 5 ms 3968 KB
20_08.txt AC 20 ms 4736 KB
20_09.txt AC 5 ms 3968 KB
20_10.txt AC 19 ms 4736 KB
20_11.txt AC 25 ms 5376 KB
20_12.txt AC 180 ms 7552 KB
20_13.txt AC 206 ms 8448 KB
20_14.txt AC 205 ms 8832 KB
20_15.txt AC 206 ms 9464 KB
20_16.txt AC 211 ms 9592 KB