AtCoder Grand Contest 012

Submission #1590025

Source codeソースコード

//
//  main.cpp
//  backToProblemSolving
//
//  Created by Khaled Abdelfattah on 6/27/17.
//  Copyright © 2017 Khaled Abdelfattah. All rights reserved.
//

#include <bits/stdc++.h>
// #include <iostream>
using namespace std;
//#include "stdc++.h"

typedef long long ll;
#define MAX 1000000000
#define BASE1 23
#define BASE2 31
#define MOD1 1000000007
#define MOD2 217645177
#define eps 1e-6

int colors[100005];
vector<int> adjList[100005];
bool visited[100005][15];
void DFS (int node, int d, int c) {
    if (d < 0 || visited[node][d])
        return;
    if (colors[node] == 0)
        colors[node] = c;
    for (int i : adjList[node])
        DFS(i, d - 1, c);
}
int main() {
    int n, m;
    cin >> n >> m;
    memset(colors, 0, n);
    memset(visited, 0, sizeof visited);
    for (int i = 0; i < m; i ++) {
        int u, v;
        scanf("%d %d", &u, &v);
        v--, u--;
        adjList[u].push_back(v);
        adjList[v].push_back(u);
    }
    int q;
    cin >> q;
    pair<pair<int, int>, int> *quers = new pair<pair<int, int>, int> [q];
    for (int i = 0; i < q; i ++) {
        int s, d, c;
        scanf("%d %d %d", &s, &d, &c);
        quers[i] = {{s - 1, d}, c};
    }
    for (int i = q - 1; i >= 0; i --)
        DFS(quers[i].first.first, quers[i].first.second, quers[i].second);
    for (int i = 0; i < n; i ++)
        cout << colors[i] << endl;
    return 0;
}

Submission

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

Compiler messageコンパイルメッセージ

./Main.cpp: In function ‘int main()’:
./Main.cpp:40:31: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d", &u, &v);
^
./Main.cpp:50:38: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d %d", &s, &d, &c);
^

Test case

Set

Set name Score得点 / Max score Cases
Sample - 00_example_01.txt,00_example_02.txt
Subtask1 0 / 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 0 / 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 4352 KB
00_example_02.txt AC 3 ms 4352 KB
10_01.txt AC 1176 ms 4352 KB
10_02.txt AC 3 ms 4352 KB
10_03.txt AC 3 ms 4352 KB
10_04.txt AC 3 ms 4352 KB
10_05.txt TLE
10_06.txt AC 18 ms 4352 KB
10_07.txt AC 5 ms 4352 KB
10_08.txt AC 74 ms 4352 KB
10_09.txt AC 57 ms 4352 KB
10_10.txt AC 54 ms 4352 KB
10_11.txt AC 102 ms 4352 KB
10_12.txt AC 75 ms 4352 KB
10_13.txt AC 8 ms 4352 KB
10_14.txt AC 9 ms 4352 KB
10_15.txt AC 7 ms 4352 KB
10_16.txt TLE
10_17.txt TLE
20_01.txt TLE
20_02.txt TLE
20_03.txt TLE
20_04.txt TLE
20_05.txt AC 465 ms 4352 KB
20_06.txt AC 146 ms 4736 KB
20_07.txt AC 113 ms 4480 KB
20_08.txt TLE
20_09.txt AC 40 ms 4352 KB
20_10.txt TLE
20_11.txt TLE
20_12.txt AC 233 ms 7680 KB
20_13.txt AC 666 ms 8704 KB
20_14.txt AC 807 ms 8832 KB
20_15.txt TLE
20_16.txt TLE