Submission #713006

#TimeUsernameProblemLanguageResultExecution timeMemory
713006lukameladzeNautilus (BOI19_nautilus)C++14
100 / 100
178 ms976 KiB
# include <bits/stdc++.h> using namespace std; #define f first #define s second // #define int long long #define free fre #define pii pair <int, int> #define pb push_back const int N = 3e5 + 5; int t,n,m,k; bitset < 505 * 505 > dp, free; // main() { cin>>n>>m>>k; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { char ch; cin>>ch; if (ch == '.') { dp[(i - 1) * (m + 2) + j] = 1; free[(i - 1) * (m + 2) + j] = 1; } } } string s; cin>>s; s = "@" + s; for (int i = 1; i <= k; i++) { char ch = s[i]; if (ch == 'E') { dp = (dp << 1) & free; } else if (ch == 'W') { dp = (dp >> 1) & free; } else if (ch == 'S') { dp = (dp << (m + 2)) & free; } else if (ch == 'N') { dp = (dp >> (m + 2)) & free; } else dp = ((dp << 1) | (dp >> 1) | (dp << (m + 2)) | (dp >> (m + 2))) & free; } /*for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { if (dp[(i - 1) * (m + 2) + j]) cout<<1;else cout<<0; } cout<<"\n"; }*/ cout<<dp.count()<<"\n"; }

Compilation message (stderr)

nautilus.cpp:13:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   13 | main() {
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...