제출 #1143325

#제출 시각아이디문제언어결과실행 시간메모리
1143325Stormtrooper007Walk (POI13_spa)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std;
bitset<5000000>used;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie();
    cout.tie();
    int n,m;
    cin>>n>>m;
    string s;
    string f;
    int st=0,fn=0;
    cin>>s>>f;
    int p=0;
    for(int i=n-1;i>=0;i++)
    {
        if(s[i]=='1')
        {
            st+=(1<<p);
        }
        p++;
    }
    p=0;
    for(int i=n-1;i>=0;i++)
    {
        if(f[i]=='1')
        {
            fn+=(1<<p);
        }
        p++;
    }
    for(int i=0;i<m;i++)
    {
        string str;
        cin>>str;
        int aux=0;
        p=0;
        for(int j=n-1;j>=0;j++)
        {
            if(str[i]=='1')
            {
                aux+=(1<<p);
            }
            p++;
        }
        used[aux]=1;
    }
    queue<string>q;
    used[st]=1;
    q.push(st);
    while(!q.empty())
    {
        string str=q.front();
        p=0;
        for(int j=n-1;j>=0;j++)
        {
            if(str[i]=='1')
            {
                aux+=(1<<p);
            }
            p++;
        }
    }
    if(mp.find(f)==mp.end())
    {
        cout<<"NIE";
    }
    else
    {
        cout<<"TAK";
    }
    return 0;
}


컴파일 시 표준 에러 (stderr) 메시지

spa.cpp: In function 'int main()':
spa.cpp:52:11: error: no matching function for call to 'std::queue<std::__cxx11::basic_string<char> >::push(int&)'
   52 |     q.push(st);
      |     ~~~~~~^~~~
In file included from /usr/include/c++/11/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:86,
                 from spa.cpp:1:
/usr/include/c++/11/bits/stl_queue.h:265:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::__cxx11::basic_string<char>; _Sequence = std::deque<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char> > >; std::queue<_Tp, _Sequence>::value_type = std::__cxx11::basic_string<char>]'
  265 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/11/bits/stl_queue.h:265:30: note:   no known conversion for argument 1 from 'int' to 'const value_type&' {aka 'const std::__cxx11::basic_string<char>&'}
  265 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_queue.h:270:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(std::queue<_Tp, _Sequence>::value_type&&) [with _Tp = std::__cxx11::basic_string<char>; _Sequence = std::deque<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char> > >; std::queue<_Tp, _Sequence>::value_type = std::__cxx11::basic_string<char>]'
  270 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/11/bits/stl_queue.h:270:25: note:   no known conversion for argument 1 from 'int' to 'std::queue<std::__cxx11::basic_string<char> >::value_type&&' {aka 'std::__cxx11::basic_string<char>&&'}
  270 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
spa.cpp:59:20: error: 'i' was not declared in this scope
   59 |             if(str[i]=='1')
      |                    ^
spa.cpp:61:17: error: 'aux' was not declared in this scope
   61 |                 aux+=(1<<p);
      |                 ^~~
spa.cpp:66:8: error: 'mp' was not declared in this scope; did you mean 'p'?
   66 |     if(mp.find(f)==mp.end())
      |        ^~
      |        p