제출 #1262239

#제출 시각아이디문제언어결과실행 시간메모리
1262239miniob질문 (CEOI14_question_grader)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
vector<int> maska;

int encode(int n, int x, int y)
{
   if(maska.size() == 0)
   {
        for(int i = 0; i < 1 << 12; i++)
        {
            bitset<12> temp = i;
            if(temp.count() == 6)
            {
                maska.push_back(i);
            }
        }
    }
    for(int i = 0; i < 12; i++)
    {
        if((maska[x] & (1 << i)) > 0 && (maska[y] & (1 << i)) == 0)
        {
            //cout << i + 1 << endl;
            return i + 1;
        }
    }
    //cout << (maska[L] & (1 << 4)) << endl;
    //cout << maska[L] << " " << maska[P] << endl;
    //cout << "kon" << endl;
}
int decode(int n, int q, int h)
{
  return (maska[q] & (1 << (h - 1)));
}

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

# 1번째 컴파일 단계

encoder.cpp:2:1: error: 'vector' does not name a type
    2 | vector<int> maska;
      | ^~~~~~
encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:6:7: error: 'maska' was not declared in this scope
    6 |    if(maska.size() == 0)
      |       ^~~~~
encoder.cpp:10:13: error: 'bitset' was not declared in this scope; did you mean 'std::bitset'?
   10 |             bitset<12> temp = i;
      |             ^~~~~~
      |             std::bitset
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:66,
                 from encoder.cpp:1:
/usr/include/c++/11/bitset:751:11: note: 'std::bitset' declared here
  751 |     class bitset
      |           ^~~~~~
encoder.cpp:10:24: error: 'temp' was not declared in this scope; did you mean 'tm'?
   10 |             bitset<12> temp = i;
      |                        ^~~~
      |                        tm
encoder.cpp:19:13: error: 'maska' was not declared in this scope
   19 |         if((maska[x] & (1 << i)) > 0 && (maska[y] & (1 << i)) == 0)
      |             ^~~~~
encoder.cpp:28:1: warning: control reaches end of non-void function [-Wreturn-type]
   28 | }
      | ^