Submission #956032

#TimeUsernameProblemLanguageResultExecution timeMemory
956032n3rm1nNautilus (BOI19_nautilus)C++17
66 / 100
8 ms10076 KiB
#include<bits/stdc++.h> #define endl '\n' using namespace std; const int MAXN = 105; void speed() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } int n, m, t; int a[MAXN][MAXN]; string operations; void read() { cin >> n >> m >> t; char s; for (int i = 1; i <= n; ++ i) { for (int j = 1; j <= m; ++ j) { cin >> s; if(s == '#')a[i][j] = 1; } } cin >> operations; operations = '+' + operations; } int dp[MAXN][MAXN][MAXN]; void solve() { for (int i = 1; i <= n; ++ i) { for (int j = 1; j <= m; ++ j) { if(!a[i][j])dp[i][j][0] = 1; } } for (int op = 1; op < operations.size(); ++ op) { for (int i = 1; i <= n; ++ i) { for (int j = 1; j <= m; ++ j) { if(a[i][j])continue; if(!dp[i][j][op-1])continue; if(operations[op] == 'N' || operations[op] == '?') { dp[i-1][j][op] = 1; } if(operations[op] == 'S' || operations[op] == '?') { dp[i+1][j][op] = 1; } if(operations[op] == 'E' || operations[op] == '?') { dp[i][j+1][op] = 1; } if(operations[op] == 'W' || operations[op] == '?') { dp[i][j-1][op] = 1; } } } } int ans = 0; for (int i = 1; i <= n; ++ i) { for (int j = 1; j <= m; ++ j) if(!a[i][j] && dp[i][j][t])ans ++; } cout << ans << endl; } int main() { speed(); read(); solve(); return 0; }

Compilation message (stderr)

nautilus.cpp: In function 'void solve()':
nautilus.cpp:45:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |     for (int op = 1; op < operations.size(); ++ op)
      |                      ~~~^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...