답안 #100983

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
100983 2019-03-15T16:47:23 Z KLPP Wand (COCI19_wand) C++14
63 / 70
86 ms 25976 KB
#include<bits/stdc++.h>

using namespace std;
typedef long long int lld;
vector<int> nei[1000000];
bool visited[1000000];
void DFS(int node){
  //ut<<node<<" ";
  for(int i=0;i<nei[node].size();i++){
    if(!visited[nei[node][i]]){
      visited[nei[node][i]]=true;
      DFS(nei[node][i]);
    }
  }
}
int main(){
  int n,m;
  scanf("%d %d",&n,&m);
 
  for(int i=0;i<m;i++){
    int x,y;
    scanf("%d %d",&x,&y);
    x--;y--;
    nei[y].push_back(x);
  }
  DFS(0);
  for(int i=0;i<n;i++){
    cout<<visited[i];
  }cout<<endl;
  return 0;
}

Compilation message

wand.cpp: In function 'void DFS(int)':
wand.cpp:9:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0;i<nei[node].size();i++){
               ~^~~~~~~~~~~~~~~~~
wand.cpp: In function 'int main()':
wand.cpp:18:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d",&n,&m);
   ~~~~~^~~~~~~~~~~~~~~
wand.cpp:22:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d",&x,&y);
     ~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 23808 KB Output is correct
2 Correct 31 ms 23800 KB Output is correct
3 Correct 83 ms 25740 KB Output is correct
4 Correct 80 ms 25720 KB Output is correct
5 Correct 70 ms 25720 KB Output is correct
6 Correct 86 ms 25824 KB Output is correct
7 Correct 74 ms 25848 KB Output is correct
8 Correct 65 ms 25848 KB Output is correct
9 Incorrect 70 ms 25848 KB Output isn't correct
10 Correct 84 ms 25976 KB Output is correct