답안 #957251

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
957251 2024-04-03T10:21:04 Z n3rm1n Nautilus (BOI19_nautilus) C++17
66 / 100
8 ms 7156 KB
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
const int MAXN = 505, MAXM = 5e3 + 10, MAXCELL = 250005;
void speed()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int n, m, t;
int a[MAXN][MAXN];
string operations;
bitset < MAXCELL > fr;
void read()
{
    cin >> n >> m >> t;
    char s;
    m += 2; /// border 0
    for (int i = 1; i <= n; ++ i)
    {
        for (int j = 1; j <= m-2; ++ j)
        {
            cin >> s;
            if(s == '#')a[i][j] = 1;
            else fr[(i - 1) * m + j] = 1;
        }
    }
    cin >> operations;
    operations = '+' + operations;
}

bitset < MAXCELL > bs[MAXM];

void solve()
{
    bs[0] = fr;
    for (int i = 1; i <= t; ++ i)
    {
        bs[i] = 0;
        if(operations[i] == 'N')
        {

            bs[i] = (bs[i-1] >> m);

            bs[i] = (bs[i] & fr);
        }
        if(operations[i] == 'S')
        {

            bs[i] = ((bs[i-1] << m) & fr);
            bs[i] = (bs[i] & fr);
        }
        if(operations[i] == 'W' )
        {

            bs[i] = (bs[i-1] >> 1);
            bs[i] = (bs[i] & fr);
        }
        if(operations[i] == 'E')
        {

            bs[i] = (bs[i-1] << 1);
            bs[i] = (bs[i] & fr);
        }
        if(operations[i] == '?')
        {
            bs[i] = (((bs[i-1] << m) | (bs[i-1] >> 1)) | ((bs[i-1] << 1) | (bs[i-1] >> m)));
            bs[i] = (bs[i] & fr);
        }
    }
    bs[t] = (bs[t] & fr);
    cout << bs[t].count() << endl;
}
int main()
{
    speed();

    read();
    solve();
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 7000 KB Output is correct
2 Correct 2 ms 7004 KB Output is correct
3 Correct 4 ms 7156 KB Output is correct
4 Correct 2 ms 6876 KB Output is correct
5 Correct 2 ms 7004 KB Output is correct
6 Correct 3 ms 7004 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 7000 KB Output is correct
2 Correct 2 ms 7004 KB Output is correct
3 Correct 4 ms 7156 KB Output is correct
4 Correct 2 ms 6876 KB Output is correct
5 Correct 2 ms 7004 KB Output is correct
6 Correct 3 ms 7004 KB Output is correct
7 Correct 4 ms 7004 KB Output is correct
8 Correct 3 ms 7004 KB Output is correct
9 Correct 4 ms 7000 KB Output is correct
10 Correct 4 ms 7004 KB Output is correct
11 Correct 3 ms 7012 KB Output is correct
12 Correct 4 ms 7004 KB Output is correct
13 Correct 4 ms 7004 KB Output is correct
14 Correct 4 ms 7012 KB Output is correct
15 Correct 4 ms 7004 KB Output is correct
16 Correct 4 ms 7004 KB Output is correct
17 Correct 4 ms 7004 KB Output is correct
18 Correct 4 ms 6828 KB Output is correct
19 Correct 5 ms 7004 KB Output is correct
20 Correct 4 ms 7004 KB Output is correct
21 Correct 5 ms 7016 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 7000 KB Output is correct
2 Correct 2 ms 7004 KB Output is correct
3 Correct 4 ms 7156 KB Output is correct
4 Correct 2 ms 6876 KB Output is correct
5 Correct 2 ms 7004 KB Output is correct
6 Correct 3 ms 7004 KB Output is correct
7 Correct 4 ms 7004 KB Output is correct
8 Correct 3 ms 7004 KB Output is correct
9 Correct 4 ms 7000 KB Output is correct
10 Correct 4 ms 7004 KB Output is correct
11 Correct 3 ms 7012 KB Output is correct
12 Correct 4 ms 7004 KB Output is correct
13 Correct 4 ms 7004 KB Output is correct
14 Correct 4 ms 7012 KB Output is correct
15 Correct 4 ms 7004 KB Output is correct
16 Correct 4 ms 7004 KB Output is correct
17 Correct 4 ms 7004 KB Output is correct
18 Correct 4 ms 6828 KB Output is correct
19 Correct 5 ms 7004 KB Output is correct
20 Correct 4 ms 7004 KB Output is correct
21 Correct 5 ms 7016 KB Output is correct
22 Runtime error 8 ms 4956 KB Execution killed with signal 11
23 Halted 0 ms 0 KB -