Submission #970399

# Submission time Handle Problem Language Result Execution time Memory
970399 2024-04-26T13:30:50 Z Aiperiii Nautilus (BOI19_nautilus) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define int long long
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
pragma GCC optimize("Ofast")
using namespace std;
const int N=505;
char a[N][N];
signed main(){
    ios_base::sync_with_stdio();
    cin.tie(0);cout.tie(0);
    int n,m,k;
    cin>>n>>m>>k;
    set <pair <int,int> > v1,v2;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin>>a[i][j];
            if(a[i][j]=='.')v1.insert({i,j});
        }
    }
    
    string s;cin>>s;
    s=' '+s;
    for(int x=0;x<k;x++){
        for(auto y : v1){
            int i=y.ff,j=y.ss;
            if((s[x+1]=='W' or s[x+1]=='?') && j-1>=0 && a[i][j-1]=='.')v2.insert({i,j-1});
            if((s[x+1]=='E' or s[x+1]=='?') && j+1<m && a[i][j+1]=='.')v2.insert({i,j+1});
            if((s[x+1]=='S' or s[x+1]=='?') && i+1<n && a[i+1][j]=='.')v2.insert({i+1,j});
            if((s[x+1]=='N' or s[x+1]=='?') && i-1>=0 && a[i-1][j]=='.')v2.insert({i-1,j});
        }
        swap(v1,v2);
        v2.clear();
    }
    cout<<v1.size();
}
/*
 5 9 7
 ...##....
 ..#.##..#
 ..#....##
 .##...#..
 ....#....
 WS?EE??
 */

Compilation message

nautilus.cpp:7:1: error: 'pragma' does not name a type; did you mean '_Pragma'?
    7 | pragma GCC optimize("Ofast")
      | ^~~~~~
      | _Pragma
nautilus.cpp: In function 'int main()':
nautilus.cpp:12:5: error: 'ios_base' has not been declared
   12 |     ios_base::sync_with_stdio();
      |     ^~~~~~~~
nautilus.cpp:13:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   13 |     cin.tie(0);cout.tie(0);
      |     ^~~
      |     std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:75,
                 from nautilus.cpp:1:
/usr/include/c++/10/iostream:60:18: note: 'std::cin' declared here
   60 |   extern istream cin;  /// Linked to standard input
      |                  ^~~
nautilus.cpp:13:16: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   13 |     cin.tie(0);cout.tie(0);
      |                ^~~~
      |                std::cout
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:75,
                 from nautilus.cpp:1:
/usr/include/c++/10/iostream:61:18: note: 'std::cout' declared here
   61 |   extern ostream cout;  /// Linked to standard output
      |                  ^~~~
nautilus.cpp:16:5: error: 'set' was not declared in this scope; did you mean 'std::set'?
   16 |     set <pair <int,int> > v1,v2;
      |     ^~~
      |     std::set
In file included from /usr/include/c++/10/set:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:87,
                 from nautilus.cpp:1:
/usr/include/c++/10/bits/stl_set.h:94:11: note: 'std::set' declared here
   94 |     class set
      |           ^~~
nautilus.cpp:16:10: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
   16 |     set <pair <int,int> > v1,v2;
      |          ^~~~
      |          std::pair
In file included from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from nautilus.cpp:1:
/usr/include/c++/10/bits/stl_pair.h:211:12: note: 'std::pair' declared here
  211 |     struct pair
      |            ^~~~
nautilus.cpp:2:13: error: expected primary-expression before 'long'
    2 | #define int long long
      |             ^~~~
nautilus.cpp:16:16: note: in expansion of macro 'int'
   16 |     set <pair <int,int> > v1,v2;
      |                ^~~
nautilus.cpp:20:29: error: 'v1' was not declared in this scope; did you mean 'y1'?
   20 |             if(a[i][j]=='.')v1.insert({i,j});
      |                             ^~
      |                             y1
nautilus.cpp:24:5: error: 'string' was not declared in this scope; did you mean 'std::string'?
   24 |     string s;cin>>s;
      |     ^~~~~~
      |     std::string
In file included from /usr/include/c++/10/iosfwd:39,
                 from /usr/include/c++/10/ios:38,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from nautilus.cpp:1:
/usr/include/c++/10/bits/stringfwd.h:79:33: note: 'std::string' declared here
   79 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
nautilus.cpp:24:19: error: 's' was not declared in this scope
   24 |     string s;cin>>s;
      |                   ^
nautilus.cpp:27:22: error: 'v1' was not declared in this scope; did you mean 'y1'?
   27 |         for(auto y : v1){
      |                      ^~
      |                      y1
nautilus.cpp:29:48: error: 'j' was not declared in this scope
   29 |             if((s[x+1]=='W' or s[x+1]=='?') && j-1>=0 && a[i][j-1]=='.')v2.insert({i,j-1});
      |                                                ^
nautilus.cpp:29:73: error: 'v2' was not declared in this scope
   29 |             if((s[x+1]=='W' or s[x+1]=='?') && j-1>=0 && a[i][j-1]=='.')v2.insert({i,j-1});
      |                                                                         ^~
nautilus.cpp:30:48: error: 'j' was not declared in this scope
   30 |             if((s[x+1]=='E' or s[x+1]=='?') && j+1<m && a[i][j+1]=='.')v2.insert({i,j+1});
      |                                                ^
nautilus.cpp:30:72: error: 'v2' was not declared in this scope
   30 |             if((s[x+1]=='E' or s[x+1]=='?') && j+1<m && a[i][j+1]=='.')v2.insert({i,j+1});
      |                                                                        ^~
nautilus.cpp:31:64: error: 'j' was not declared in this scope
   31 |             if((s[x+1]=='S' or s[x+1]=='?') && i+1<n && a[i+1][j]=='.')v2.insert({i+1,j});
      |                                                                ^
nautilus.cpp:31:72: error: 'v2' was not declared in this scope
   31 |             if((s[x+1]=='S' or s[x+1]=='?') && i+1<n && a[i+1][j]=='.')v2.insert({i+1,j});
      |                                                                        ^~
nautilus.cpp:32:65: error: 'j' was not declared in this scope
   32 |             if((s[x+1]=='N' or s[x+1]=='?') && i-1>=0 && a[i-1][j]=='.')v2.insert({i-1,j});
      |                                                                 ^
nautilus.cpp:32:73: error: 'v2' was not declared in this scope
   32 |             if((s[x+1]=='N' or s[x+1]=='?') && i-1>=0 && a[i-1][j]=='.')v2.insert({i-1,j});
      |                                                                         ^~
nautilus.cpp:34:14: error: 'v1' was not declared in this scope; did you mean 'y1'?
   34 |         swap(v1,v2);
      |              ^~
      |              y1
nautilus.cpp:34:17: error: 'v2' was not declared in this scope
   34 |         swap(v1,v2);
      |                 ^~
nautilus.cpp:34:9: error: 'swap' was not declared in this scope
   34 |         swap(v1,v2);
      |         ^~~~
nautilus.cpp:34:9: note: suggested alternatives:
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from nautilus.cpp:1:
/usr/include/c++/10/bits/regex.h:2141:5: note:   'std::__cxx11::swap'
 2141 |     swap(match_results<_Bi_iter, _Alloc>& __lhs,
      |     ^~~~
In file included from /usr/include/c++/10/exception:147,
                 from /usr/include/c++/10/ios:39,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from nautilus.cpp:1:
/usr/include/c++/10/bits/exception_ptr.h:169:5: note:   'std::__exception_ptr::swap'
  169 |     swap(exception_ptr& __lhs, exception_ptr& __rhs)
      |     ^~~~
In file included from /usr/include/c++/10/bits/nested_exception.h:40,
                 from /usr/include/c++/10/exception:148,
                 from /usr/include/c++/10/ios:39,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from nautilus.cpp:1:
/usr/include/c++/10/bits/move.h:189:5: note:   'std::swap'
  189 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
nautilus.cpp:37:11: error: 'v1' was not declared in this scope; did you mean 'y1'?
   37 |     cout<<v1.size();
      |           ^~
      |           y1