답안 #134868

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
134868 2019-07-23T10:55:58 Z Bodo171 Nautilus (BOI19_nautilus) C++14
100 / 100
317 ms 892 KB
#include <iostream>
#include <fstream>
#include <bitset>
using namespace std;
const int nmax=1005;
string s,mov;
bitset<nmax> can[nmax],niu[nmax],ok[nmax];
int n,m,k,i,j,mv;
int main()
{
    ios_base::sync_with_stdio(false);
    cin>>n>>m>>k;
    for(i=1;i<=n;i++)
    {
        cin>>s;
        for(j=0;j<m;j++)
        {
            if(s[j]=='.')
            {
                ok[i][j]=1,can[i][j]=1;
            }
        }
    }
    cin>>mov;
    for(int mv=0;mv<mov.size();mv++)
    {
        if(mov[mv]=='N')
        {
            for(i=1;i<=n+1;i++)
               can[i-1]=((can[i]&ok[i-1]));
        }
        if(mov[mv]=='S')
        {
            for(i=n;i>=0;i--)
               can[i+1]=(can[i]&ok[i+1]);
        }
        if(mov[mv]=='E')
        {
            for(i=1;i<=n;i++)
                can[i]=((can[i]<<1)&ok[i]);
        }
        if(mov[mv]=='W')
        {
            for(i=1;i<=n;i++)
                can[i]=((can[i]>>1)&ok[i]);
        }
        if(mov[mv]=='?')
        {
            for(i=1;i<=n;i++)
              niu[i]=((can[i-1]|can[i+1]|(can[i]>>1)|(can[i]<<1))&ok[i]);
            for(i=1;i<=n;i++)
                can[i]=niu[i];
        }
    }
    int ans=0;
    for(i=1;i<=n;i++)
       ans+=can[i].count();
    cout<<ans;
    return 0;
}

Compilation message

nautilus.cpp: In function 'int main()':
nautilus.cpp:25:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int mv=0;mv<mov.size();mv++)
                  ~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 380 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 380 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 3 ms 376 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 3 ms 376 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 3 ms 376 KB Output is correct
16 Correct 3 ms 376 KB Output is correct
17 Correct 3 ms 376 KB Output is correct
18 Correct 3 ms 376 KB Output is correct
19 Correct 3 ms 376 KB Output is correct
20 Correct 3 ms 376 KB Output is correct
21 Correct 3 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 380 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 3 ms 376 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 3 ms 376 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 3 ms 376 KB Output is correct
16 Correct 3 ms 376 KB Output is correct
17 Correct 3 ms 376 KB Output is correct
18 Correct 3 ms 376 KB Output is correct
19 Correct 3 ms 376 KB Output is correct
20 Correct 3 ms 376 KB Output is correct
21 Correct 3 ms 376 KB Output is correct
22 Correct 149 ms 760 KB Output is correct
23 Correct 150 ms 880 KB Output is correct
24 Correct 146 ms 852 KB Output is correct
25 Correct 146 ms 888 KB Output is correct
26 Correct 144 ms 888 KB Output is correct
27 Correct 241 ms 840 KB Output is correct
28 Correct 245 ms 860 KB Output is correct
29 Correct 243 ms 888 KB Output is correct
30 Correct 248 ms 892 KB Output is correct
31 Correct 243 ms 796 KB Output is correct
32 Correct 314 ms 760 KB Output is correct
33 Correct 315 ms 888 KB Output is correct
34 Correct 314 ms 844 KB Output is correct
35 Correct 311 ms 760 KB Output is correct
36 Correct 317 ms 760 KB Output is correct