Submission #28089

#TimeUsernameProblemLanguageResultExecution timeMemory
28089aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa (#71)The City and The Bitcoin (FXCUP2_city)C++14
0 / 1
0 ms2464 KiB
#include <bits/stdc++.h> using namespace std; int N,M; int a[302][302]; bool check[302][302]; int dx[] = {0,1,0,-1}; int dy[] = {1,0,-1,0}; void dfs(int x,int y){ check[x][y] = true; for(int i=0; i<4; i++){ if(a[x+dx[i]][y+dy[i]] == 0 || check[x+dx[i]][y+dy[i]]) continue; dfs(x+dx[i],y+dy[i]); } } int main(){ scanf("%d %d",&M,&N); for(int i=1; i<=N; i++){ for(int j=1; j<=M; j++){ scanf("%d",&a[i][j]); } } dfs(1,1); printf("%s\n",check[N][M]?"YES":"NO"); return 0; }

Compilation message (stderr)

city.cpp: In function 'int main()':
city.cpp:20:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d",&M,&N);
                      ^
city.cpp:23:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d",&a[i][j]);
                        ^
#Verdict Execution timeMemoryGrader output
Fetching results...