Submission #452145

# Submission time Handle Problem Language Result Execution time Memory
452145 2021-08-03T22:35:29 Z Ozy Nautilus (BOI19_nautilus) C++17
100 / 100
120 ms 708 KB
#include <iostream>
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define repa(i,a,b) for(int i = (a); i >= (b); i--)
#define lli unsigned long long int
#define debug(a) cout << #a << " = " << a << endl
#define debugsl(a) cout << #a << " = " << a << ", "

lli f,c,m;
bitset<502> pas[502],nuevo[502],mapa[502];
char x;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> f >> c >> m;
    rep(i,1,f) {
        rep(j,1,c) {
            cin >> x;
            if (x == '.') mapa[i][j] = true;
            else mapa[i][j] = false;

            pas[i][j] = mapa[i][j];
        }
    }

    rep(T,1,m) {

        cin >> x;
        rep(i,1,f) {

            if (x == 'N') nuevo[i] = pas[i+1]&mapa[i];
            else if (x == 'S') nuevo[i] = pas[i-1]&mapa[i];
            else if (x == 'W') nuevo[i] = (pas[i] >> 1)&mapa[i];
            else if (x == 'E') nuevo[i] = (pas[i] << 1)&mapa[i];
            else {
                nuevo[i] = (pas[i+1] | pas[i-1]);
                nuevo[i] |= (pas[i] << 1)|(pas[i] >> 1);
                nuevo[i] &= mapa[i];
            }

        }

        swap(pas,nuevo);
    }

    lli sum = 0;
    rep(i,1,f) {
        rep(j,1,c) {
            if (pas[i][j] == 1) sum++;
        }
    }
    cout << sum;

}

Compilation message

nautilus.cpp: In function 'int main()':
nautilus.cpp:5:39: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
    5 | #define rep(i,a,b) for(int i = (a); i <= (b); i++)
      |                                       ^
nautilus.cpp:21:5: note: in expansion of macro 'rep'
   21 |     rep(i,1,f) {
      |     ^~~
nautilus.cpp:5:39: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
    5 | #define rep(i,a,b) for(int i = (a); i <= (b); i++)
      |                                       ^
nautilus.cpp:22:9: note: in expansion of macro 'rep'
   22 |         rep(j,1,c) {
      |         ^~~
nautilus.cpp:5:39: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
    5 | #define rep(i,a,b) for(int i = (a); i <= (b); i++)
      |                                       ^
nautilus.cpp:31:5: note: in expansion of macro 'rep'
   31 |     rep(T,1,m) {
      |     ^~~
nautilus.cpp:5:39: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
    5 | #define rep(i,a,b) for(int i = (a); i <= (b); i++)
      |                                       ^
nautilus.cpp:34:9: note: in expansion of macro 'rep'
   34 |         rep(i,1,f) {
      |         ^~~
nautilus.cpp:5:39: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
    5 | #define rep(i,a,b) for(int i = (a); i <= (b); i++)
      |                                       ^
nautilus.cpp:52:5: note: in expansion of macro 'rep'
   52 |     rep(i,1,f) {
      |     ^~~
nautilus.cpp:5:39: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
    5 | #define rep(i,a,b) for(int i = (a); i <= (b); i++)
      |                                       ^
nautilus.cpp:53:9: note: in expansion of macro 'rep'
   53 |         rep(j,1,c) {
      |         ^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 328 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 2 ms 332 KB Output is correct
16 Correct 2 ms 332 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 2 ms 332 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 328 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 2 ms 332 KB Output is correct
16 Correct 2 ms 332 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 2 ms 332 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 70 ms 588 KB Output is correct
23 Correct 71 ms 644 KB Output is correct
24 Correct 69 ms 588 KB Output is correct
25 Correct 68 ms 588 KB Output is correct
26 Correct 69 ms 588 KB Output is correct
27 Correct 96 ms 640 KB Output is correct
28 Correct 100 ms 588 KB Output is correct
29 Correct 93 ms 636 KB Output is correct
30 Correct 95 ms 644 KB Output is correct
31 Correct 93 ms 588 KB Output is correct
32 Correct 115 ms 588 KB Output is correct
33 Correct 114 ms 708 KB Output is correct
34 Correct 113 ms 640 KB Output is correct
35 Correct 120 ms 640 KB Output is correct
36 Correct 119 ms 588 KB Output is correct