답안 #729793

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
729793 2023-04-24T14:51:25 Z vjudge1 Nautilus (BOI19_nautilus) C++14
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    int r,c;
    string m;
    cin>>r>>c;
    char mat[r][c];
    for(int i=0;i<r;i++)
    {
        for(int j=0;j<c;j++)
        {
            cin>>mat[i][j];
        }
    }
    int ans=0;
    queue<int>Q;
    for(int i=0;i<r;i++)
    {
        for(int j=0;j<c;j++)
        {
            if(mat[i][j]=='.')///"";
            {
                Q.push(i);
                Q.push(j);
                Q.push(0);
                while(!Q.empty())
                {
                    int ti=Q.front();Q.pop();
                    int tj=Q.front();Q.pop();
                    int k=Q.front();Q.pop();
                    if(k==m.size())
                    {
                        ans++;
                    }
                    else
                    {
                        if(m[k]=='?')
                        {

                        }
                        else
                        {
                            int ci=0;
                            int cj=0;
                            if(m[k]=='N')
                            {
                                ci=ti+-1;
                            }
                            else if(m[k]=='S')
                            {
                                ci=ti+1;
                            }
                            else if(m[k]=='W')
                            {
                                cj=tj-1;
                            }
                            else
                            {
                                cj=tj+1;
                            }
                            if(ci<0||cj<0||ci>=r||cj>=c)continue;
                            if(mat[ci][cj]=='#')continue;
                            Q.push(ci);
                            Q.push(cj);
                            Q.push(k+1);
                        }
                    }
                }
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Compilation message

nautilus.cpp: In function 'int main()':
nautilus.cpp:35:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |                     if(k==m.size())
      |                        ~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -