Submission #175469

#TimeUsernameProblemLanguageResultExecution timeMemory
175469AlexLuchianovNautilus (BOI19_nautilus)C++14
100 / 100
340 ms1400 KiB
#include <iostream> #include <bitset> using namespace std; using ll = long long; #define MIN(a, b) (((a) < (b)) ? (a) : (b)) #define MAX(a, b) (((a) < (b)) ? (b) : (a)) int const nmax = 500; char v[1 + nmax][1 + nmax]; char mv[1 + nmax * 10]; int main() { int n, m, moves; cin >> n >> m >> moves; bitset<nmax * (nmax + 1)> sol, possible; for(int i = 1;i <= n; i++) for(int j = 1;j <= m; j++) { cin >> v[i][j]; if(v[i][j] == '.') sol[(i - 1) * (m + 1) + j] = 1; } possible = sol; for(int i = 1;i <= moves; i++) cin >> mv[i]; for(int i = 1; i <= moves; i++){ if(mv[i] == 'N') sol = (sol >> (m + 1)) & possible; else if(mv[i] == 'S') sol = (sol << (m + 1)) & possible; else if(mv[i] == 'W') sol = (sol >> 1) & possible; else if(mv[i] == 'E') sol = (sol << 1) & possible; else{ sol = ((sol >> (m + 1)) | (sol << (m + 1)) | (sol >> 1) | (sol << 1)) & possible; } } cout << sol.count(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...