답안 #540870

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
540870 2022-03-21T21:45:04 Z Olympia Nautilus (BOI19_nautilus) C++17
컴파일 오류
0 ms 0 KB
#include <cmath>
#include <iostream>
#include <set>
#include <climits>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <string>
#include <vector>
#include <iomanip>
#include <unordered_map>
#include <type_traits>
#include <string>
#include <queue>
#define ll long long
#include <map>

using namespace std;
vector<string> vec;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int R, C, M;
    cin >> R >> C >> M;
    vec.resize(R);
    for (int i = 0; i < R; i++) {
        cin >> vec[i];
        assert(vec[i].size() == C);
    }
    string s;
    cin >> s;
    bitset<10000> orig;
    for (int i = 0; i < R; i++) {
        for (int j = 0; j < C; j++) {
            //cout << C * i + j << '\n';
            if (vec[i][j] == '.') {
                orig.set(C * i + j + 500);
            }
        }
    }
    bitset<10000> pos = orig;
    map<char,pair<int,int>> myMap;
    myMap['W'] = {0, -1};
    myMap['E'] = {0, 1};
    myMap['S'] = {1, 0};
    myMap['N'] = {-1, 0};
    //cout << pos.count() << '\n';
    for (int i = 0; i < s.length(); i++) {
        bitset<10000> valid;
        for (char c: {'W', 'N', 'S', 'E'}) {
            if (s[i] == c || s[i] == '?') {
                bitset<10000> dum = pos;
                if (myMap[c].second != 0) {
                    if (myMap[c].second > 0) dum >>= 1;
                    else dum <<= 1;
                } else {
                    if (myMap[c].first > 0) dum <<= C;
                    else dum >>= C;
                }
                valid = valid | (dum & orig);
            }
        }
        pos = valid;
        //cout << pos.count() << '\n';
    }
    cout << pos.count() << '\n';
}

Compilation message

In file included from /usr/include/c++/10/cassert:44,
                 from nautilus.cpp:7:
nautilus.cpp: In function 'int main()':
nautilus.cpp:28:30: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   28 |         assert(vec[i].size() == C);
      |                ~~~~~~~~~~~~~~^~~~
nautilus.cpp:32:5: error: 'bitset' was not declared in this scope
   32 |     bitset<10000> orig;
      |     ^~~~~~
nautilus.cpp:17:1: note: 'std::bitset' is defined in header '<bitset>'; did you forget to '#include <bitset>'?
   16 | #include <map>
  +++ |+#include <bitset>
   17 | 
nautilus.cpp:32:19: error: 'orig' was not declared in this scope
   32 |     bitset<10000> orig;
      |                   ^~~~
nautilus.cpp:41:19: error: 'pos' was not declared in this scope; did you mean 'pow'?
   41 |     bitset<10000> pos = orig;
      |                   ^~~
      |                   pow
nautilus.cpp:48:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |     for (int i = 0; i < s.length(); i++) {
      |                     ~~^~~~~~~~~~~~
nautilus.cpp:49:23: error: 'valid' was not declared in this scope
   49 |         bitset<10000> valid;
      |                       ^~~~~
nautilus.cpp:52:31: error: 'dum' was not declared in this scope
   52 |                 bitset<10000> dum = pos;
      |                               ^~~