Submission #899784

# Submission time Handle Problem Language Result Execution time Memory
899784 2024-01-07T02:01:47 Z ForgottenDestiny Dango Maker (JOI18_dango_maker) C++17
Compilation error
0 ms 0 KB
include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,m;
    cin>>n>>m;
    vector<string> graph(n);
    vector<vector<bool>> visited(n,vector<bool>(m));
    for (int i=0;i<n;i++){
        cin>>graph[i];
    }
    long long res=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(j>0&&j<m-1&&graph[i][j]=='G'&&graph[i][j-1]=='R'&&graph[i][j+1]=='W'&&!visited[i][j-1]&&!visited[i][j]&&!visited[i][j+1]) {
                res++;
                visited[i][j]=true;
                visited[i][j-1]=true;
                visited[i][j+1]=true;
            } else if (i>0&&i<n-1&&graph[i][j]=='G'&&graph[i-1][j]=='R'&&graph[i+1][j]=='W'&&!visited[i-1][j]&&!visited[i][j]&&!visited[i+1][j]){
                res++;
                visited[i][j]=true;
                visited[i-1][j]=true;
                visited[i+1][j]=true;
            }
        }
    }
    cout<<res<<"\n";
    

    return 0;
}

Compilation message

dango_maker.cpp:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
dango_maker.cpp: In function 'int main()':
dango_maker.cpp:5:5: error: 'ios' has not been declared
    5 |     ios::sync_with_stdio(false);
      |     ^~~
dango_maker.cpp:6:5: error: 'cin' was not declared in this scope
    6 |     cin.tie(nullptr);
      |     ^~~
dango_maker.cpp:9:5: error: 'vector' was not declared in this scope
    9 |     vector<string> graph(n);
      |     ^~~~~~
dango_maker.cpp:9:12: error: 'string' was not declared in this scope
    9 |     vector<string> graph(n);
      |            ^~~~~~
dango_maker.cpp:9:20: error: 'graph' was not declared in this scope
    9 |     vector<string> graph(n);
      |                    ^~~~~
dango_maker.cpp:10:19: error: expected primary-expression before 'bool'
   10 |     vector<vector<bool>> visited(n,vector<bool>(m));
      |                   ^~~~
dango_maker.cpp:17:87: error: 'visited' was not declared in this scope
   17 |             if(j>0&&j<m-1&&graph[i][j]=='G'&&graph[i][j-1]=='R'&&graph[i][j+1]=='W'&&!visited[i][j-1]&&!visited[i][j]&&!visited[i][j+1]) {
      |                                                                                       ^~~~~~~
dango_maker.cpp:30:5: error: 'cout' was not declared in this scope
   30 |     cout<<res<<"\n";
      |     ^~~~