Submission #729793

# Submission time Handle Problem Language Result Execution time Memory
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())
      |                        ~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -