Submission #925383

#TimeUsernameProblemLanguageResultExecution timeMemory
925383IsamEmacs (COCI20_emacs)C++17
50 / 50
1 ms348 KiB
#include<bits/stdc++.h> using namespace std; int N, M; char grid[101][101]; int dx[ ] = {-1, 1, 0, 0}, dy[ ] = {0, 0, 1, -1}; bool vis[101][101]; bool OK(int& x, int& y){ return (x >= 0 && y >= 0 && x < N && y < M); } inline void Dfs(int& x, int& y){ vis[x][y] = 1; for (register int i = 0; i < 4; ++i){ int tx = x + dx[i], ty = y + dy[i]; if(!OK(tx, ty)) continue; if(vis[tx][ty]) continue; Dfs(tx, ty); } return; } signed main(){ ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> N >> M; for (register int i = 0; i < N; ++i){ for (register int j = 0; j < M; ++j){ cin >> grid[i][j]; if(grid[i][j] ^ '*') vis[i][j] = 1; } } int ans(0); for (register int i = 0; i < N; ++i){ for (register int j = 0; j < M; ++j){ if(grid[i][j] == '*' && !vis[i][j]){ Dfs(i, j); ++ans; } } } cout << ans << '\n'; return 0; }

Compilation message (stderr)

emacs.cpp: In function 'void Dfs(int&, int&)':
emacs.cpp:18:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   18 |  for (register int i = 0; i < 4; ++i){
      |                    ^
emacs.cpp: In function 'int main()':
emacs.cpp:30:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   30 |  for (register int i = 0; i < N; ++i){
      |                    ^
emacs.cpp:31:21: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   31 |   for (register int j = 0; j < M; ++j){
      |                     ^
emacs.cpp:37:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   37 |  for (register int i = 0; i < N; ++i){
      |                    ^
emacs.cpp:38:21: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   38 |   for (register int j = 0; j < M; ++j){
      |                     ^
#Verdict Execution timeMemoryGrader output
Fetching results...