제출 #243342

#제출 시각아이디문제언어결과실행 시간메모리
243342LawlietNautilus (BOI19_nautilus)C++17
100 / 100
283 ms768 KiB
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 510;
const int MAXT = 5010;

int n, m, k;

string s;

bitset<MAXN> dp[MAXN][2], v[MAXN];

int main()
{
	cin >> n >> m >> k;

	for(int i = 1 ; i <= n ; i++)
	{
		for(int j = 1 ; j <= m ; j++)
		{
			char c;
			scanf(" %c",&c);

			if( c == '.' ) v[i][j] = 1;
		}
	}

	cin >> s;

	for(int i = 1 ; i <= n ; i++)
		dp[i][1] = v[i];

	for(int t = 0 ; t < k ; t++)
	{
		for(int i = 1 ; i <= n ; i++)
		{
			dp[i][t%2].reset();

			if( s[t] == 'N' || s[t] == '?' ) dp[i][t%2] = ( dp[i][t%2] | dp[i + 1][1 - t%2] );
			if( s[t] == 'S' || s[t] == '?' ) dp[i][t%2] = ( dp[i][t%2] | dp[i - 1][1 - t%2] );
			if( s[t] == 'E' || s[t] == '?' ) dp[i][t%2] = ( dp[i][t%2] | ( dp[i][1 - t%2] << 1 ) );
			if( s[t] == 'W' || s[t] == '?' ) dp[i][t%2] = ( dp[i][t%2] | ( dp[i][1 - t%2] >> 1 ) );

			dp[i][t%2] = ( dp[i][t%2] & v[i] );
		}
	}

	int ans = 0;

	for(int i = 1 ; i <= n ; i++)
		ans += dp[i][1 - k%2].count();

	printf("%d\n",ans);
}

컴파일 시 표준 에러 (stderr) 메시지

nautilus.cpp: In function 'int main()':
nautilus.cpp:23:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf(" %c",&c);
    ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...