Submission #246728

# Submission time Handle Problem Language Result Execution time Memory
246728 2020-07-10T03:35:17 Z quadraticreciprocity Emacs (COCI20_emacs) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
char board[3000][3000];
ll n, k;
bool visited[3000][3000];
void dfs(ll x, ll y){
    if(x<1 or x>n or y<1 or y>k or visited[x][y] or board[x][y]!='*'){
        return;
    }
    visited[x][y]=1;
    dfs(x+1, y);
    dfs(x, y-1);
    dfs(x-1, y);
    dfs(x, y+1);
}
int main(){
    cin>>n>>k;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=k;j++){
            cin>>board[i][j];
        }
    }
    ll answer=0;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=k;j++){
            if(!visited[i][j] && board[i][j]=='*'){
                ++answer;dfs(i, j);
            }
        }
    }
    cout<<answer<<'\n';
}

Compilation message

emacs.cpp:4:1: error: 'll' does not name a type
 ll n, k;
 ^~
emacs.cpp:6:10: error: variable or field 'dfs' declared void
 void dfs(ll x, ll y){
          ^~
emacs.cpp:6:10: error: 'll' was not declared in this scope
emacs.cpp:6:16: error: 'll' was not declared in this scope
 void dfs(ll x, ll y){
                ^~
emacs.cpp: In function 'int main()':
emacs.cpp:17:10: error: 'n' was not declared in this scope
     cin>>n>>k;
          ^
emacs.cpp:17:10: note: suggested alternative: 'yn'
     cin>>n>>k;
          ^
          yn
emacs.cpp:17:13: error: 'k' was not declared in this scope
     cin>>n>>k;
             ^
emacs.cpp:23:5: error: 'll' was not declared in this scope
     ll answer=0;
     ^~
emacs.cpp:27:19: error: 'answer' was not declared in this scope
                 ++answer;dfs(i, j);
                   ^~~~~~
emacs.cpp:27:19: note: suggested alternative: 'assert'
                 ++answer;dfs(i, j);
                   ^~~~~~
                   assert
emacs.cpp:27:26: error: 'dfs' was not declared in this scope
                 ++answer;dfs(i, j);
                          ^~~
emacs.cpp:27:26: note: suggested alternative: 'ffs'
                 ++answer;dfs(i, j);
                          ^~~
                          ffs
emacs.cpp:31:11: error: 'answer' was not declared in this scope
     cout<<answer<<'\n';
           ^~~~~~
emacs.cpp:31:11: note: suggested alternative: 'assert'
     cout<<answer<<'\n';
           ^~~~~~
           assert