# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
496334 | Ziel | Nautilus (BOI19_nautilus) | C++17 | 3 ms | 332 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/**
* LES GREATEABLES BRO TEAM
**/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define sz(x) (int)x.size()
const bool FLAG = false;
void setIO(const string &f = "");
void solve() {
int r, c, m;
cin >> r >> c >> m;
vector<vector<char>> a(r + 1, vector<char>(c + 1));
for (int i = 1; i <= r; i++) {
for (int j = 1; j <= c; j++) {
cin >> a[i][j];
}
}
string s;
cin >> s;
int ans = 0;
auto in_frame = [r, c](int x, int y) -> bool {
return x >= 1 && x <= r && y >= 1 && y <= c;
};
for (int i = 1; i <= r; i++) {
for (int j = 1; j <= c; j++) {
int ci = i, cj = j;
bool ok = true;
for (int k = 0; k < m; k++) {
if (s[k] == 'N') ci--;
if (s[k] == 'S') ci++;
if (s[k] == 'E') cj++;
if (s[k] == 'W') cj--;
if (in_frame(ci, cj) && a[ci][cj] == '.')
continue;
else {
ok = false;
break;
}
}
ans += ok;
}
}
cout << ans;
}
signed main() {
setIO();
int tt = 1;
if (FLAG) {
cin >> tt;
}
while (tt--) {
solve();
}
return 0;
}
void setIO(const string &f) {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
if (fopen((f + ".in").c_str(), "r")) {
freopen((f + ".in").c_str(), "r", stdin);
freopen((f + ".out").c_str(), "w", stdout);
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |