답안 #314308

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
314308 2020-10-19T15:51:36 Z shrek12357 Nautilus (BOI19_nautilus) C++14
29 / 100
4 ms 384 KB
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <climits>
#include <cmath>
#include <fstream>
#include <queue>
#include <stack>
#include <bitset>
using namespace std;
#define ll long long
//cin.tie(0);ios_base::sync_with_stdio(0); 

int main() {
	int r, c, m;
	cin >> r >> c >> m;
	int grid[105][105];
	for (int i = 0; i < r; i++) {
		for (int j = 0; j < c; j++) {
			char x;
			cin >> x;
			if (x == '.') {
				grid[i][j] = 1;
			}
			else {
				grid[i][j] = 0;
			}
		}
	}
	string s;
	cin >> s;
	int counter = 0;
	for (int i = 0; i < r; i++) {
		for (int j = 0; j < c; j++) {
			int curX = i, curY = j;
			bool bad = false;
			if (grid[i][j] == 0) {
				continue;
			}
			for (int k = 0; k < m; k++) {
				if (s[k] == 'W') {
					curY--;
				}
				if (s[k] == 'E') {
					curY++;
				}
				if (s[k] == 'N') {
					curX--;
				}
				if (s[k] == 'S') {
					curX++;
				}
				if (curX >= r || curX < 0 || curY >= c || curY < 0 || grid[curX][curY] == 0) {
					bad = true;
					break;
				}
			}
			if (!bad) {
				counter++;
			}
		}
	}
	cout << counter << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Incorrect 4 ms 384 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Incorrect 4 ms 384 KB Output isn't correct
8 Halted 0 ms 0 KB -