답안 #526212

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
526212 2022-02-14T00:42:44 Z Yazan_Alattar Nautilus (BOI19_nautilus) C++14
66 / 100
26 ms 784 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pb push_back
#define endl "\n"
#define all(x) x.begin(), x.end()
const int M = 105;
const ll inf = 2e9;
const ll mod = 998244353;
const double pi = acos(-1);
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
const char dirs[] = {'S', 'E', 'N', 'W'};

vector < vector <ll> > dp(M, vector <ll> (M));
ll n, m, ans, len;
string s;
char a[M][M];

int main()
{
	cin >> n >> m >> len;
	for(int i = 1; i <= n; ++i) for(int j = 1; j <= m; ++j) cin >> a[i][j], dp[i][j] = 1;
	cin >> s;
	for(int idx = 0; idx < len; ++idx){
		vector < vector <ll> > to(M, vector <ll> (M));
		for(int i = 1; i <= n; ++i) for(int j = 1; j <= m; ++j) if(a[i][j] != '#')
			for(int dir = 0; dir < 4; ++dir) if(s[idx] == '?' || s[idx] == dirs[dir])
				to[i + dx[dir]][j + dy[dir]] |= dp[i][j];
		dp = to;
	}
	for(int i = 1; i <= n; ++i) for(int j = 1; j <= m; ++j) if(a[i][j] != '#') ans += dp[i][j];
	cout << ans << endl;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 480 KB Output is correct
2 Correct 10 ms 480 KB Output is correct
3 Correct 10 ms 460 KB Output is correct
4 Correct 10 ms 384 KB Output is correct
5 Correct 6 ms 460 KB Output is correct
6 Correct 3 ms 460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 480 KB Output is correct
2 Correct 10 ms 480 KB Output is correct
3 Correct 10 ms 460 KB Output is correct
4 Correct 10 ms 384 KB Output is correct
5 Correct 6 ms 460 KB Output is correct
6 Correct 3 ms 460 KB Output is correct
7 Correct 12 ms 476 KB Output is correct
8 Correct 13 ms 460 KB Output is correct
9 Correct 12 ms 460 KB Output is correct
10 Correct 7 ms 460 KB Output is correct
11 Correct 3 ms 396 KB Output is correct
12 Correct 21 ms 492 KB Output is correct
13 Correct 20 ms 392 KB Output is correct
14 Correct 18 ms 488 KB Output is correct
15 Correct 9 ms 492 KB Output is correct
16 Correct 3 ms 460 KB Output is correct
17 Correct 26 ms 460 KB Output is correct
18 Correct 23 ms 460 KB Output is correct
19 Correct 16 ms 460 KB Output is correct
20 Correct 9 ms 496 KB Output is correct
21 Correct 3 ms 460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 480 KB Output is correct
2 Correct 10 ms 480 KB Output is correct
3 Correct 10 ms 460 KB Output is correct
4 Correct 10 ms 384 KB Output is correct
5 Correct 6 ms 460 KB Output is correct
6 Correct 3 ms 460 KB Output is correct
7 Correct 12 ms 476 KB Output is correct
8 Correct 13 ms 460 KB Output is correct
9 Correct 12 ms 460 KB Output is correct
10 Correct 7 ms 460 KB Output is correct
11 Correct 3 ms 396 KB Output is correct
12 Correct 21 ms 492 KB Output is correct
13 Correct 20 ms 392 KB Output is correct
14 Correct 18 ms 488 KB Output is correct
15 Correct 9 ms 492 KB Output is correct
16 Correct 3 ms 460 KB Output is correct
17 Correct 26 ms 460 KB Output is correct
18 Correct 23 ms 460 KB Output is correct
19 Correct 16 ms 460 KB Output is correct
20 Correct 9 ms 496 KB Output is correct
21 Correct 3 ms 460 KB Output is correct
22 Runtime error 4 ms 784 KB Execution killed with signal 11
23 Halted 0 ms 0 KB -