제출 #1224213

#제출 시각아이디문제언어결과실행 시간메모리
1224213sleepntsheepNautilus (BOI19_nautilus)C++20
0 / 100
1092 ms320 KiB
#include <cstdio>
#include <cstring>

int r, c, m, dx[] = { -1, 1, 0, 0 }, dy[] = { 0, 0, 1, -1 }, z;
char d[333], s[333][333];

int main() {
	scanf("%d%d%d", &r, &c, &m);
	for (int i = 0; i < r; ++i)
		scanf("%s", s[i]);
	scanf("%s", d);

	for (int i = 0; i < r; ++i) {
		for (int j = 0; j < c; ++j) {
			int i_, j_, ok;

			i_ = i, j_ = j, ok = 1;

			if (s[i][j] == '#') continue;

			for (int k = m - 1; k >= 0; --k) {
				const char *ss = "EWNS";
				int k_ = strchr(ss, d[k]) - ss;
				i_ += dy[k_], j += dx[k_];
				if (i_ < 0 || j_ < 0 || i_ >= r || j_ >= c || s[i_][j_] == '#') {
					ok = 0;
					break;
				}
			}

			if (ok)
				++z;
		}
	}

	printf("%d\n", z);
	return 0;
}

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

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