답안 #647571

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
647571 2022-10-03T07:51:40 Z berr Nautilus (BOI19_nautilus) C++17
100 / 100
191 ms 724 KB
#include <bits/stdc++.h>
using namespace std;
 
int32_t main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n, m, k; cin>>n>>m>>k;

    bitset<505> grid[n], sea[n];
    for(int i=0; i<n; i++)
    {
        for(int l=0; l<m; l++)
        {
            char x; cin>>x;
            if(x=='.') sea[i][l]=grid[i][l]=1;
            else sea[i][l]=grid[i][l]=0;
        }
    }


    string s; cin>>s;

    for(int i=0; i<s.size(); i++)
    {   
        bitset<505> tmp[n];

        if(s[i]=='W'||s[i]=='?')
        {
            for(int l=0; l<n; l++)
            {
                tmp[l]|=(sea[l]&(grid[l]>>1));
            }
        }
        if(s[i]=='E'||s[i]=='?')
        {
            for(int l=0; l<n; l++)
            {
                tmp[l]|=sea[l]&(grid[l]<<1);
            }
        }
        if(s[i]=='N'||s[i]=='?')
        {
            for(int l=0; l<n-1; l++)
            {
                tmp[l]|=(sea[l]&grid[l+1]);

            }
        }
        if(s[i]=='S'||s[i]=='?')
        {
            for(int l=1; l<n; l++)
            {
                tmp[l]|=sea[l]&grid[l-1];
            }
        }

        for(int l=0; l<n; l++)
        {
            grid[l]=tmp[l];
        }

    
    }

    int ans=0;
    for(int i=0; i<n; i++)
    {
        for(int l=0; l<m; l++)
        {
            if(grid[i][l]) ans++;
        }
    }

    cout<<ans;
}

Compilation message

nautilus.cpp: In function 'int32_t main()':
nautilus.cpp:23:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for(int i=0; i<s.size(); i++)
      |                  ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 376 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 376 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 320 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 2 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 328 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 2 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 2 ms 340 KB Output is correct
18 Correct 2 ms 340 KB Output is correct
19 Correct 2 ms 340 KB Output is correct
20 Correct 2 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 376 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 320 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 2 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 328 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 2 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 2 ms 340 KB Output is correct
18 Correct 2 ms 340 KB Output is correct
19 Correct 2 ms 340 KB Output is correct
20 Correct 2 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 94 ms 656 KB Output is correct
23 Correct 97 ms 652 KB Output is correct
24 Correct 93 ms 724 KB Output is correct
25 Correct 93 ms 632 KB Output is correct
26 Correct 86 ms 660 KB Output is correct
27 Correct 140 ms 716 KB Output is correct
28 Correct 144 ms 596 KB Output is correct
29 Correct 141 ms 652 KB Output is correct
30 Correct 148 ms 656 KB Output is correct
31 Correct 144 ms 652 KB Output is correct
32 Correct 182 ms 648 KB Output is correct
33 Correct 191 ms 652 KB Output is correct
34 Correct 190 ms 716 KB Output is correct
35 Correct 187 ms 652 KB Output is correct
36 Correct 186 ms 596 KB Output is correct