Submission #1273924

#TimeUsernameProblemLanguageResultExecution timeMemory
1273924SmuggingSpunEmacs (COCI20_emacs)C++20
50 / 50
2 ms580 KiB
#include<bits/stdc++.h> #define taskname "A" using namespace std; const int lim = 105; char a[lim][lim]; int n, m, ans = 0; void dfs(int x, int y){ if(x < 1 || x > n || y < 1 || y > m || a[x][y] != '*'){ return; } a[x][y] = '.'; dfs(x - 1, y); dfs(x + 1, y); dfs(x, y - 1); dfs(x, y + 1); } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if(fopen(taskname".inp", "r")){ freopen(taskname".inp", "r", stdin); } cin >> n >> m; for(int i = 1; i <= n; i++){ for(int j = 1; j <= m; j++){ cin >> a[i][j]; } } for(int i = 1; i <= n; i++){ for(int j = 1; j <= m; j++){ if(a[i][j] == '*'){ ans++; dfs(i, j); } } } cout << ans; }

Compilation message (stderr)

emacs.cpp: In function 'int main()':
emacs.cpp:20:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |                 freopen(taskname".inp", "r", stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...