답안 #723462

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
723462 2023-04-13T21:39:31 Z lovrot Nautilus (BOI19_nautilus) C++17
66 / 100
101 ms 608 KB
#include <cstdio>
#include <cstring>
#include <bitset>

using namespace std; 

const int N = 500; 

bitset<N> M[2][N + 2], S[N];

int main() {
	int n, m, q;
	scanf("%d%d%d", &n, &m, &q); 
	for(int i = 1; i <= n; i++) 
		for(int j = 0; j < m; j++) {
			char c;
			scanf(" %c", &c);
			S[i].set(j, c == '.'); 
			M[0][i].set(j, c == '.'); 
		}
	bool f = 0;
	for(int t = 0; t < q; t++) {
		char c;
		scanf(" %c", &c); 
		f ^= 1;
		for(int i = 1; i <= n; i++) {
			if(c == 'W') M[f][i] = S[i] & (M[!f][i] >> 1);
			else if(c == 'E') M[f][i] = S[i] & (M[!f][i] << 1); 
			else if(c == 'N') M[f][i] = S[i] & M[!f][i + 1]; 
			else if(c == 'S') M[f][i] = S[i] & M[!f][i - 1]; 
			else M[f][i] = S[i] & ((M[!f][i] << 1) | (M[!f][i] >> 1) | M[!f][i - 1] | M[!f][i + 1]);
		}
	}
	int sol = 0; 
	for(int i = 1; i <= n; i++)
		sol += M[f][i].count();
	printf("%d\n", sol); 
	return 0;
}

Compilation message

nautilus.cpp: In function 'int main()':
nautilus.cpp:13:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |  scanf("%d%d%d", &n, &m, &q);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~
nautilus.cpp:17:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |    scanf(" %c", &c);
      |    ~~~~~^~~~~~~~~~~
nautilus.cpp:24:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |   scanf(" %c", &c);
      |   ~~~~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 2 ms 212 KB Output is correct
12 Correct 2 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 2 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 2 ms 212 KB Output is correct
17 Correct 2 ms 212 KB Output is correct
18 Correct 2 ms 212 KB Output is correct
19 Correct 2 ms 212 KB Output is correct
20 Correct 2 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 2 ms 212 KB Output is correct
12 Correct 2 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 2 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 2 ms 212 KB Output is correct
17 Correct 2 ms 212 KB Output is correct
18 Correct 2 ms 212 KB Output is correct
19 Correct 2 ms 212 KB Output is correct
20 Correct 2 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 94 ms 356 KB Output is correct
23 Incorrect 101 ms 608 KB Output isn't correct
24 Halted 0 ms 0 KB -