답안 #956032

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
956032 2024-03-31T20:02:42 Z n3rm1n Nautilus (BOI19_nautilus) C++17
66 / 100
8 ms 10076 KB
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
const int MAXN = 105;
void speed()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int n, m, t;
int a[MAXN][MAXN];
string operations;

void read()
{
    cin >> n >> m >> t;
    char s;
    for (int i = 1; i <= n; ++ i)
    {
        for (int j = 1; j <= m; ++ j)
        {
            cin >> s;
            if(s == '#')a[i][j] = 1;
        }
    }
    cin >> operations;
    operations = '+' + operations;
}

int dp[MAXN][MAXN][MAXN];

void solve()
{
    for (int i = 1; i <= n; ++ i)
    {
        for (int j = 1; j <= m; ++ j)
        {
            if(!a[i][j])dp[i][j][0] = 1;

            }

    }

    for (int op = 1; op < operations.size(); ++ op)
    {
        for (int i = 1; i <= n; ++ i)
        {
            for (int j = 1; j <= m; ++ j)
            {
                if(a[i][j])continue;
                if(!dp[i][j][op-1])continue;
                if(operations[op] == 'N' || operations[op] == '?')
                {
                    dp[i-1][j][op] = 1;
                }
                if(operations[op] == 'S' || operations[op] == '?')
                {
                    dp[i+1][j][op] = 1;
                }
               if(operations[op] == 'E' || operations[op] == '?')
                {
                    dp[i][j+1][op] = 1;
                }
                if(operations[op] == 'W' || operations[op] == '?')
                {
                    dp[i][j-1][op] = 1;
                }
            }
        }
    }
    int ans = 0;
    for (int i = 1; i <= n; ++ i)
    {
        for (int j = 1; j <= m; ++ j)
            if(!a[i][j] && dp[i][j][t])ans ++;
    }
    cout << ans << endl;
}
int main()
{
    speed();

    read();
    solve();
    return 0;
}

Compilation message

nautilus.cpp: In function 'void solve()':
nautilus.cpp:45:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |     for (int op = 1; op < operations.size(); ++ op)
      |                      ~~~^~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4700 KB Output is correct
2 Correct 4 ms 4744 KB Output is correct
3 Correct 4 ms 4700 KB Output is correct
4 Correct 4 ms 4868 KB Output is correct
5 Correct 2 ms 4700 KB Output is correct
6 Correct 2 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4700 KB Output is correct
2 Correct 4 ms 4744 KB Output is correct
3 Correct 4 ms 4700 KB Output is correct
4 Correct 4 ms 4868 KB Output is correct
5 Correct 2 ms 4700 KB Output is correct
6 Correct 2 ms 2396 KB Output is correct
7 Correct 5 ms 4824 KB Output is correct
8 Correct 7 ms 4824 KB Output is correct
9 Correct 5 ms 4700 KB Output is correct
10 Correct 3 ms 4700 KB Output is correct
11 Correct 2 ms 2396 KB Output is correct
12 Correct 5 ms 4700 KB Output is correct
13 Correct 6 ms 4700 KB Output is correct
14 Correct 8 ms 4912 KB Output is correct
15 Correct 3 ms 4696 KB Output is correct
16 Correct 2 ms 2392 KB Output is correct
17 Correct 5 ms 4696 KB Output is correct
18 Correct 8 ms 5464 KB Output is correct
19 Correct 5 ms 4700 KB Output is correct
20 Correct 3 ms 4700 KB Output is correct
21 Correct 2 ms 2392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4700 KB Output is correct
2 Correct 4 ms 4744 KB Output is correct
3 Correct 4 ms 4700 KB Output is correct
4 Correct 4 ms 4868 KB Output is correct
5 Correct 2 ms 4700 KB Output is correct
6 Correct 2 ms 2396 KB Output is correct
7 Correct 5 ms 4824 KB Output is correct
8 Correct 7 ms 4824 KB Output is correct
9 Correct 5 ms 4700 KB Output is correct
10 Correct 3 ms 4700 KB Output is correct
11 Correct 2 ms 2396 KB Output is correct
12 Correct 5 ms 4700 KB Output is correct
13 Correct 6 ms 4700 KB Output is correct
14 Correct 8 ms 4912 KB Output is correct
15 Correct 3 ms 4696 KB Output is correct
16 Correct 2 ms 2392 KB Output is correct
17 Correct 5 ms 4696 KB Output is correct
18 Correct 8 ms 5464 KB Output is correct
19 Correct 5 ms 4700 KB Output is correct
20 Correct 3 ms 4700 KB Output is correct
21 Correct 2 ms 2392 KB Output is correct
22 Runtime error 7 ms 10076 KB Execution killed with signal 11
23 Halted 0 ms 0 KB -