Submission #328783

#TimeUsernameProblemLanguageResultExecution timeMemory
328783egasNautilus (BOI19_nautilus)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; set<pair<long long,long long> > ss; long long solve(long long r,long long c,long long pt,vector<string> &grid,string &path) { if(r<0 or r>=grid.size() or c<0 or c>=grid[0].size())return 0; if(grid[r][c]==' if(pt==path.size()){ ss.insert({r,c}); return 1; } if(path[pt]=='?') { return solve(r,c-1,pt+1,grid,path) + solve(r,c+1,pt+1,grid,path) + solve(r-1,c,pt+1,grid,path) + solve(r+1,c,pt+1,grid,path); } else { if(path[pt]=='W') { return solve(r,c-1,pt+1,grid,path); } else if(path[pt]=='E') { return solve(r,c+1,pt+1,grid,path); } else if(path[pt]=='N') { return solve(r-1,c,pt+1,grid,path); } else if(path[pt]=='S') { return solve(r+1,c,pt+1,grid,path); } else { assert(0); } } return 0; } int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); long long r; cin >> r; long long c; cin >> c; long long m; cin >> m; vector<string> grid; for(long long i = 0 ; i < r ; i++) { string temp; cin >> temp; grid.push_back(temp); } string path; cin >> path; for(long long i = 0 ; i < r ; i++) { for(long long j = 0 ; j < c ; j++) { solve(i,j,0,grid,path); } } cout << ss.size() << '\n'; return 0; }

Compilation message (stderr)

nautilus.cpp:11:20: warning: missing terminating ' character
   11 |     if(grid[r][c]=='
      |                    ^
nautilus.cpp:11:20: error: missing terminating ' character
nautilus.cpp: In function 'long long int solve(long long int, long long int, long long int, std::vector<std::__cxx11::basic_string<char> >&, std::string&)':
nautilus.cpp:9:16: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     if(r<0 or r>=grid.size() or c<0 or c>=grid[0].size())return 0;
      |               ~^~~~~~~~~~~~~
nautilus.cpp:9:41: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     if(r<0 or r>=grid.size() or c<0 or c>=grid[0].size())return 0;
      |                                        ~^~~~~~~~~~~~~~~~
nautilus.cpp:11:8: warning: init-statement in selection statements only available with '-std=c++17' or '-std=gnu++17'
   11 |     if(grid[r][c]=='
      |        ^~~~
nautilus.cpp:13:5: error: expected primary-expression before 'if'
   13 |     if(pt==path.size()){
      |     ^~
nautilus.cpp:21:5: error: expected primary-expression before 'if'
   21 |     if(path[pt]=='?') {
      |     ^~
nautilus.cpp:19:10: error: expected ')' before 'if'
   19 |         }
      |          ^
      |          )
   20 | 
   21 |     if(path[pt]=='?') {
      |     ~~    
nautilus.cpp:11:7: note: to match this '('
   11 |     if(grid[r][c]=='
      |       ^
nautilus.cpp:53:1: warning: control reaches end of non-void function [-Wreturn-type]
   53 | }
      | ^