제출 #125006

#제출 시각아이디문제언어결과실행 시간메모리
125006gs14004Nautilus (BOI19_nautilus)C++17
100 / 100
213 ms1016 KiB
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 505;

int n, m, k;
bitset<MAXN> dp[MAXN], nxt[MAXN], grid[MAXN];
char str[MAXN][MAXN];

int main(){
	scanf("%d %d %d",&n,&m,&k);
	for(int i=0; i<n; i++){
		scanf("%s", str[i]);
		for(int j=0; j<m; j++){
			if(str[i][j] == '.') grid[i].set(j);
		}
		dp[i] = grid[i];
	}
	string q; cin >> q;
	for(auto &i : q){
		for(int j=0; j<n; j++) nxt[j] = 0;
		if(i == 'W' || i == '?'){
			for(int j=0; j<n; j++) nxt[j] |= (dp[j] >> 1);
		}
		if(i == 'E' || i == '?'){
			for(int j=0; j<n; j++) nxt[j] |= (dp[j] << 1);
		}
		if(i == 'N' || i == '?'){
			for(int j=1; j<n; j++) nxt[j-1] |= dp[j];
		}
		if(i == 'S' || i == '?'){
			for(int j=1; j<n; j++) nxt[j] |= dp[j-1];
		}
		for(int j=0; j<n; j++) dp[j] = nxt[j] & grid[j];
	}
	int ret = 0;
	for(int j=0; j<n; j++) ret += dp[j].count();
	cout << ret << endl;
}

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

nautilus.cpp: In function 'int main()':
nautilus.cpp:10:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d %d",&n,&m,&k);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~
nautilus.cpp:12:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s", str[i]);
   ~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...