Submission #210627

# Submission time Handle Problem Language Result Execution time Memory
210627 2020-03-17T23:44:38 Z casperwang Nautilus (BOI19_nautilus) C++14
29 / 100
8 ms 376 KB
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 500;
int r, c, m;
int cnt;
string str;
string mp[MAXN+5];
int arr[MAXN+5][MAXN+5];

bool f(int i, int j) {
  if (mp[i][j] == '#') return 0;
  for (int k = 0; k < m; k++) {
    if (str[k] == 'N') i--;
    if (str[k] == 'S') i++;
    if (str[k] == 'W') j--;
    if (str[k] == 'E') j++;
    if (mp[i][j] == '#') return 0;
  }
  return 1;
}

signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> r >> c >> m;
  for (int i = 1; i <= r; i++) {
    cin >> mp[i];
    mp[i] = "#" + mp[i] + "#";
  }
  cin >> str;
  for (int i = 0; i <= c+1; i++) {
    mp[0] = mp[0] + "#";
    mp[r+1] = mp[r+1] + "#";
  }
  for (int i = 1; i <= r; i++)
    for (int j = 1; j <= c; j++)
      cnt += f(i, j);
  cout << cnt << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 7 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Incorrect 8 ms 376 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Incorrect 8 ms 376 KB Output isn't correct
8 Halted 0 ms 0 KB -