답안 #590326

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
590326 2022-07-05T20:38:31 Z penguinhacker Flight to the Ford (BOI22_communication) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "communication.h"

mt19937 rng(42);

map<bitset<100>, int> mp;

void encode(int n, int x) {
	bitset<100> b;
	for (int i=0; i<100; ++i)
		b[i]=send(rng()%2);
	mp[b]=x;
}

pair<int, int> decode(int n) {
	bitset<100> b;
	for (int i=0; i<100; ++i)
		b[i]=receive();
	int ans=mp[b];
	return {ans, ans};
}

Compilation message

communication.cpp:4:1: error: 'mt19937' does not name a type
    4 | mt19937 rng(42);
      | ^~~~~~~
communication.cpp:6:1: error: 'map' does not name a type
    6 | map<bitset<100>, int> mp;
      | ^~~
communication.cpp: In function 'void encode(int, int)':
communication.cpp:9:2: error: 'bitset' was not declared in this scope; did you mean 'std::bitset'?
    9 |  bitset<100> b;
      |  ^~~~~~
      |  std::bitset
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:66,
                 from communication.cpp:1:
/usr/include/c++/10/bitset:751:11: note: 'std::bitset' declared here
  751 |     class bitset
      |           ^~~~~~
communication.cpp:9:14: error: 'b' was not declared in this scope
    9 |  bitset<100> b;
      |              ^
communication.cpp:11:13: error: 'rng' was not declared in this scope
   11 |   b[i]=send(rng()%2);
      |             ^~~
communication.cpp:12:2: error: 'mp' was not declared in this scope
   12 |  mp[b]=x;
      |  ^~
communication.cpp: At global scope:
communication.cpp:15:1: error: 'pair' does not name a type
   15 | pair<int, int> decode(int n) {
      | ^~~~