| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 679419 | vjudge1 | Nautilus (BOI19_nautilus) | C++17 | 162 ms | 716 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ull unsigned long long
#define ed '\n'
#define pb push_back
#define ii pair<int,int>
#define o_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define fi first
#define se second
using namespace __gnu_pbds;
using namespace std;
bitset<502> d[502], d2[502];
int n, m, k;
inline void Do(char c) {
bitset<502> tmp[502];
//for(int i = 1; i <= n; ++i) tmp[i] = d[i];
for(int i = 1; i <= n; ++i) {
if (c == 'W' || c == '?') tmp[i] |= (d[i] >> 1);
if (c == 'E' || c == '?') tmp[i] |= (d[i] << 1);
if (c == 'N' || c == '?') tmp[i - 1] |= d[i];
if (c == 'S' || c == '?') tmp[i + 1] |= d[i];
}
for(int i = 1; i <= n; ++i) {
d[i] = tmp[i] & d2[i];
}
}
void solve() {
cin >> n >> m >> k;
for(int i = 1; i <= n; ++i) {
for(int j = 1; j <= m; ++j) {
char c;
cin >> c;
if (c == '.') d[i].set(j), d2[i].set(j);
}
}
string s;
cin >> s;
for(int i = 0; i < k; ++i) {
Do(s[i]);
// return;
}
int ans = 0;
for(int i = 1; i <= n; ++i) {
for(int j = 1; j <= m; ++j) {
ans += d[i][j];
}
}
cout << ans << ed;
//cout << ans;
}
signed main() {
ios_base::sync_with_stdio(0); cin.tie(0);
if (fopen("cf.inp", "r")) {
freopen("cf.inp", "r", stdin);
//freopen("cf.inp", "w", stdout);
}
solve();
return 0;
}
Compilation message (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... | ||||
