답안 #210627

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
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";
}
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -