답안 #448658

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
448658 2021-07-31T12:06:26 Z vanic 질문 (CEOI14_question_grader) C++14
컴파일 오류
0 ms 0 KB
#include <set>
#include <vector>

set < int > s;
vector < set < int > > v;

void rek(int x, int br){
	if(x==13){
		return;
	}
	if(br==6){
		v.push_back(s);
		return;
	}
	s.insert(x);
	rek(x+1, br+1);
	s.erase(x);
	rek(x+1, br);
}

void precompute(){
	rek(1, 0);
}

int encode (int n, int x, int y) {
	precompute();
	set < int > s1, s2;
	s1=v[x];
	s2=v[y];
	while(!s2.empty()){
		s1.erase(*s2.begin());
		s2.erase(s2.begin());
	}
	return *s1.begin();
}
#include <set>
#include <vector>

set < int > s;
vector < set < int > > v;

void rek(int x, int br){
	if(x==13){
		return;
	}
	if(br==6){
		v.push_back(s);
		return;
	}
	s.insert(x);
	rek(x+1, br+1);
	s.erase(x);
	rek(x+1, br);
}

void precompute(){
	rek(1, 0);
}

int decode (int n, int q, int h) {
	precompute();
	set < int > s1=v[q];
	if(s1.find(h)!=s1.end()){
		return 1;
	}
	return 0;
}


Compilation message

encoder.cpp:4:1: error: 'set' does not name a type
    4 | set < int > s;
      | ^~~
encoder.cpp:5:1: error: 'vector' does not name a type
    5 | vector < set < int > > v;
      | ^~~~~~
encoder.cpp: In function 'void rek(int, int)':
encoder.cpp:12:3: error: 'v' was not declared in this scope
   12 |   v.push_back(s);
      |   ^
encoder.cpp:12:15: error: 's' was not declared in this scope
   12 |   v.push_back(s);
      |               ^
encoder.cpp:15:2: error: 's' was not declared in this scope
   15 |  s.insert(x);
      |  ^
encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:27:2: error: 'set' was not declared in this scope; did you mean 'std::set'?
   27 |  set < int > s1, s2;
      |  ^~~
      |  std::set
In file included from /usr/include/c++/10/set:61,
                 from encoder.cpp:1:
/usr/include/c++/10/bits/stl_set.h:94:11: note: 'std::set' declared here
   94 |     class set
      |           ^~~
encoder.cpp:27:8: error: expected primary-expression before 'int'
   27 |  set < int > s1, s2;
      |        ^~~
encoder.cpp:28:2: error: 's1' was not declared in this scope
   28 |  s1=v[x];
      |  ^~
encoder.cpp:28:5: error: 'v' was not declared in this scope
   28 |  s1=v[x];
      |     ^
encoder.cpp:29:2: error: 's2' was not declared in this scope
   29 |  s2=v[y];
      |  ^~

decoder.cpp:4:1: error: 'set' does not name a type
    4 | set < int > s;
      | ^~~
decoder.cpp:5:1: error: 'vector' does not name a type
    5 | vector < set < int > > v;
      | ^~~~~~
decoder.cpp: In function 'void rek(int, int)':
decoder.cpp:12:3: error: 'v' was not declared in this scope
   12 |   v.push_back(s);
      |   ^
decoder.cpp:12:15: error: 's' was not declared in this scope
   12 |   v.push_back(s);
      |               ^
decoder.cpp:15:2: error: 's' was not declared in this scope
   15 |  s.insert(x);
      |  ^
decoder.cpp: In function 'int decode(int, int, int)':
decoder.cpp:27:2: error: 'set' was not declared in this scope; did you mean 'std::set'?
   27 |  set < int > s1=v[q];
      |  ^~~
      |  std::set
In file included from /usr/include/c++/10/set:61,
                 from decoder.cpp:1:
/usr/include/c++/10/bits/stl_set.h:94:11: note: 'std::set' declared here
   94 |     class set
      |           ^~~
decoder.cpp:27:8: error: expected primary-expression before 'int'
   27 |  set < int > s1=v[q];
      |        ^~~
decoder.cpp:28:5: error: 's1' was not declared in this scope
   28 |  if(s1.find(h)!=s1.end()){
      |     ^~