Submission #335303

# Submission time Handle Problem Language Result Execution time Memory
335303 2020-12-11T22:07:29 Z Vladth11 Nautilus (BOI19_nautilus) C++14
66 / 100
96 ms 1004 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define debug(x) cerr << #x << " " << x << "\n"
#define debug_with_space(x) cerr << #x << " " << x << " "

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair <ll, ll> pii;
typedef pair <ll, pii> piii;
typedef tree <pii, null_type, less <pii>, rb_tree_tag, tree_order_statistics_node_update> OST;

const ll NMAX = 100001;
const ll INF = (1LL << 60);
const ll MOD = 1000000007;
const ll BLOCK = 101;
const ll nr_of_bits = 35;

bitset <501 * 501> init, b, nou, cop;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, m, t;
    cin >> n >> m >> t;
    int cc = 0;
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= m; j++){
            char c;
            cin >> c;
            if(c != '#'){
                cc++;
                init[i * (m + 2) + j + 1].flip();
            }
        }
    }
    string s;
    cin >> s;
    b = init;
    m+=2;
    n+=2;
    for(int i = 0; i < s.size(); i++){
        if(s[i] != '?'){
            if(s[i] == 'E'){
                b <<= 1;
            }else if(s[i] == 'W'){
                b >>= 1;
            }else if(s[i] == 'N'){
                b >>= m;
            }else{
                b <<= m;
            }
            b &= init;
        }else{
            cop = b;
            nou = b;
            nou <<= 1;
            nou &= init;
            b = nou;
            nou = cop;
            nou >>= 1;
            nou &= init;
            b |= nou;
            nou = cop;
            nou >>= m;
            nou &= init;
            b |= nou;
            nou = cop;
            nou <<= m;
            nou &= init;
            b |= nou;
            b &= init;
        }
    }
    cout << b.count();
    return 0;
}

Compilation message

nautilus.cpp: In function 'int main()':
nautilus.cpp:44:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |     for(int i = 0; i < s.size(); i++){
      |                    ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 3 ms 492 KB Output is correct
8 Correct 3 ms 492 KB Output is correct
9 Correct 3 ms 492 KB Output is correct
10 Correct 3 ms 492 KB Output is correct
11 Correct 3 ms 492 KB Output is correct
12 Correct 4 ms 492 KB Output is correct
13 Correct 4 ms 492 KB Output is correct
14 Correct 4 ms 512 KB Output is correct
15 Correct 4 ms 492 KB Output is correct
16 Correct 4 ms 492 KB Output is correct
17 Correct 6 ms 492 KB Output is correct
18 Correct 6 ms 492 KB Output is correct
19 Correct 7 ms 492 KB Output is correct
20 Correct 6 ms 492 KB Output is correct
21 Correct 6 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 3 ms 492 KB Output is correct
8 Correct 3 ms 492 KB Output is correct
9 Correct 3 ms 492 KB Output is correct
10 Correct 3 ms 492 KB Output is correct
11 Correct 3 ms 492 KB Output is correct
12 Correct 4 ms 492 KB Output is correct
13 Correct 4 ms 492 KB Output is correct
14 Correct 4 ms 512 KB Output is correct
15 Correct 4 ms 492 KB Output is correct
16 Correct 4 ms 492 KB Output is correct
17 Correct 6 ms 492 KB Output is correct
18 Correct 6 ms 492 KB Output is correct
19 Correct 7 ms 492 KB Output is correct
20 Correct 6 ms 492 KB Output is correct
21 Correct 6 ms 512 KB Output is correct
22 Runtime error 96 ms 1004 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Halted 0 ms 0 KB -