Submission #1195366


Source Code Expand

#include <iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<queue>
#include<vector>
#include<map>
typedef long long ll;
#define cle(n) memset(n,0,sizeof(n))
#define maxn 100005
using namespace std;

int n,m;
vector<int>edge[maxn];
int in[maxn];
void dfs(int p,int a,int b)
{
    if(a==0) return;

  for(int i=0;i<edge[p].size();i++)
           {
               in[edge[p][i]]=b;
               dfs(edge[p][i],a-1,b);
           }
        // cout<<"fuck"<<endl;
}



int main()
{
  while(scanf("%d%d",&n,&m))
  {
      cle(in);
      for(int i=0;i<m;i++)
        edge[i].clear();

      for(int i=0;i<m;i++)
      {
          int a,b;
          scanf("%d%d",&a,&b);

          edge[a].push_back(b);
           edge[b].push_back(a);
      }

   int num;

   scanf("%d",&num);
   for(int i=0;i<num;i++)
   {
     int p,a,b;
     scanf("%d%d%d",&p,&a,&b);
        ///表示 点  和距离 和  颜色
     in[p]=b;
          dfs(p,a,b);
   }
  // cout<<"输出"<<endl;
   for(int i=1;i<=n;i++)
   cout<<in[i]<<endl;

  }
 return 0;
}

Submission Info

Submission Time
Task B - Splatter Painting
User zcc
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1138 Byte
Status TLE
Exec Time 2104 ms
Memory 15084 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:42:30: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
           scanf("%d%d",&a,&b);
                              ^
./Main.cpp:50:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d",&num);
                    ^
./Main.cpp:54:30: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
      scanf("%d%d%d",&p,&a,&b);
                              ^

Judge Result

Set Name Sample Subtask1 All
Score / Max Score 0 / 0 0 / 200 0 / 500
Status
TLE × 2
TLE × 19
TLE × 35
Set Name Test Cases
Sample 00_example_01.txt, 00_example_02.txt
Subtask1 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 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
Case Name Status Exec Time Memory
00_example_01.txt TLE 2103 ms 3840 KB
00_example_02.txt TLE 2103 ms 4224 KB
10_01.txt TLE 2103 ms 3712 KB
10_02.txt TLE 2103 ms 5376 KB
10_03.txt TLE 2104 ms 5368 KB
10_04.txt TLE 2104 ms 5628 KB
10_05.txt TLE 2103 ms 3584 KB
10_06.txt TLE 2103 ms 3200 KB
10_07.txt TLE 2103 ms 5760 KB
10_08.txt TLE 2103 ms 4864 KB
10_09.txt TLE 2104 ms 4864 KB
10_10.txt TLE 2104 ms 8708 KB
10_11.txt TLE 2103 ms 4736 KB
10_12.txt TLE 2104 ms 4864 KB
10_13.txt TLE 2103 ms 5120 KB
10_14.txt TLE 2104 ms 15084 KB
10_15.txt TLE 2103 ms 5248 KB
10_16.txt TLE 2103 ms 3072 KB
10_17.txt TLE 2103 ms 3072 KB
20_01.txt TLE 2104 ms 5760 KB
20_02.txt TLE 2104 ms 5760 KB
20_03.txt TLE 2104 ms 5760 KB
20_04.txt TLE 2104 ms 3584 KB
20_05.txt TLE 2103 ms 3712 KB
20_06.txt TLE 2103 ms 5888 KB
20_07.txt TLE 2103 ms 3712 KB
20_08.txt TLE 2104 ms 3072 KB
20_09.txt TLE 2104 ms 4096 KB
20_10.txt TLE 2104 ms 2944 KB
20_11.txt TLE 2103 ms 3072 KB
20_12.txt TLE 2104 ms 8996 KB
20_13.txt TLE 2104 ms 8740 KB
20_14.txt TLE 2104 ms 8564 KB
20_15.txt TLE 2104 ms 6520 KB
20_16.txt TLE 2104 ms 6520 KB