제출 #133985

#제출 시각아이디문제언어결과실행 시간메모리
133985CaroLindaTracks in the Snow (BOI13_tracks)C++14
8.85 / 100
2045 ms13432 KiB
#include <bits/stdc++.h> #define MAXN 510 #define lp(i,a,b) for(int i=a;i<b;i++) using namespace std ; int n , m ; int mat[MAXN][MAXN] ; int dx[4] = {1,0,-1,0} ; int dy[4] = {0,-1,0,1} ; bool valid(int x, int y) { return (x>=0 && x< n && y>=0 && y<m) ; } int tot = 0 ; int dfs(int x , int y , int busco) { tot ++ ; mat[x][y] = !busco ; lp(i,0,4) { int a = x + dx[i] ; int b = y+dy[i] ; if( !valid(a,b) || mat[a][b] != busco ) continue ; dfs(a,b,busco) ; } } int main() { scanf("%d%d", &n , &m ) ; lp(i,0,n) lp(j,0,m) { char c ; scanf(" %c", &c ) ; mat[i][j] = (c=='R' ? 0 : 1) ; } int ant = 0 , animal = 0 ; while(true) { tot = 0 ; dfs(0,0,mat[0][0]) ; if( ant == tot ) break ; animal ++ ; ant = tot ; } printf("%d\n" , animal ) ; }

컴파일 시 표준 에러 (stderr) 메시지

tracks.cpp: In function 'int dfs(int, int, int)':
tracks.cpp:34:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
tracks.cpp: In function 'int main()':
tracks.cpp:38:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &n , &m ) ;
  ~~~~~^~~~~~~~~~~~~~~~~~
tracks.cpp:43:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf(" %c", &c ) ;
    ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...