답안 #260321

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
260321 2020-08-10T05:20:44 Z arnold518 Nautilus (BOI19_nautilus) C++14
0 / 100
1 ms 1536 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAXN = 500;
const int MAXM = 5000;

int R, C, M;
char S[MAXN+10][MAXN+10];
char A[MAXM+10];
bitset<501> B[MAXN+10];
bitset<501> D[MAXN+10][MAXM+10];

int main()
{
	scanf("%d%d%d", &R, &C, &M);
	for(int i=1; i<=R; i++) scanf("%s", S[i]+1);
	scanf("%s", A+1);

	for(int i=1; i<=R; i++) for(int j=1; j<=C; j++) if(S[i][j]=='.') B[i][j-1]=1;
	for(int i=1; i<=R; i++) D[i][0]=B[i];

	for(int p=1; p<=M; p++)
	{
		if(A[p]=='N' || A[p]=='?')
		{
			for(int i=1; i<R; i++)
			{
				D[i][p]|=D[i+1][p-1];
			}
		}
		if(A[p]=='S' || A[p]=='?')
		{
			for(int i=2; i<=R; i++)
			{
				D[i][p]|=D[i-1][p-1];
			}	
		}
		if(A[p]=='E' || A[p]=='?')
		{
			for(int i=1; i<=R; i++)
			{
				D[i][p]|=D[i][p-1]<<1;
			}
		}
		if(A[p]=='W' || A[p]=='?')
		{
			for(int i=1; i<=R; i++)
			{
				D[i][p]|=D[i][p-1]>>1;
			}
		}
		for(int i=1; i<=R; i++) D[i][p]&=B[i];
	}
	int ans=0;
	for(int i=1; i<=R; i++) for(int j=0; j<=C/64; j++) ans+=D[i][M].count();
	printf("%d\n", ans);
}

Compilation message

nautilus.cpp: In function 'int main()':
nautilus.cpp:19:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%d", &R, &C, &M);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~
nautilus.cpp:20:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1; i<=R; i++) scanf("%s", S[i]+1);
                          ~~~~~^~~~~~~~~~~~~~
nautilus.cpp:21:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%s", A+1);
  ~~~~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 1536 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 1536 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 1536 KB Output isn't correct
2 Halted 0 ms 0 KB -