Submission #1111317

#TimeUsernameProblemLanguageResultExecution timeMemory
1111317hainam2k9Nautilus (BOI19_nautilus)C++17
100 / 100
144 ms158888 KiB
#include <bits/stdc++.h> #define tt cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(0) #define fo freopen((NAME+".INP").c_str(), "r", stdin), freopen((NAME+".OUT").c_str(), "w", stdout) #define ll long long #define ull unsigned long long #define i128 __int128 #define db long double #define sz(a) ((int)(a).size()) #define pb emplace_back #define pf emplace_front #define pob pop_back #define pof pop_front #define lb lower_bound #define ub upper_bound #define fi first #define se second #define ins emplace using namespace std; const int MOD = 1e9+7, MAXN = 1e5+5; const string NAME = ""; int n,m,k,rs=0; bitset<505> dp[5005][505],mask[505]; char c; int main() { tt; if(fopen((NAME + ".INP").c_str(), "r")) fo; cin >> n >> m >> k; for(int i = 1; i<=n; ++i) for(int j = 1; j<=m; ++j){ cin >> c; if(c=='.') dp[0][i][j]=1, mask[i][j]=1; } for(int i = 1; i<=k; ++i){ cin >> c; for(int j = 1; j<=n; ++j){ if(c=='N'||c=='?') dp[i][j]|=dp[i-1][j+1]; if(c=='S'||c=='?') dp[i][j]|=dp[i-1][j-1]; if(c=='W'||c=='?') dp[i][j]|=dp[i-1][j]>>1; if(c=='E'||c=='?') dp[i][j]|=dp[i-1][j]<<1; dp[i][j]&=mask[j]; } } for(int i = 1; i<=n; ++i) rs+=dp[k][i].count(); cout << rs; }

Compilation message (stderr)

nautilus.cpp: In function 'int main()':
nautilus.cpp:3:19: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    3 | #define fo freopen((NAME+".INP").c_str(), "r", stdin), freopen((NAME+".OUT").c_str(), "w", stdout)
      |            ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nautilus.cpp:27:45: note: in expansion of macro 'fo'
   27 |     if(fopen((NAME + ".INP").c_str(), "r")) fo;
      |                                             ^~
nautilus.cpp:3:63: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    3 | #define fo freopen((NAME+".INP").c_str(), "r", stdin), freopen((NAME+".OUT").c_str(), "w", stdout)
      |                                                        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nautilus.cpp:27:45: note: in expansion of macro 'fo'
   27 |     if(fopen((NAME + ".INP").c_str(), "r")) fo;
      |                                             ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...