Submission #396378

# Submission time Handle Problem Language Result Execution time Memory
396378 2021-04-29T22:15:46 Z ChrisT Shopping (JOI21_shopping) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "Anna.h"
using namespace std;
const int MN = 1e6 + 5;
vector<int> go,mx; int ind = 0, bit = 0, L, R;
void InitA (int n, int l, int r) {
	L = l; R = r;
	int baseL = 0, baseR = 0;
	for (int i = 14; i > 5; i--) {
		sendA(l>>i&1);
		baseL |= (l & (1 << i));
	}
	for (int i = 14; i > 5; i--) {
		sendA(r>>i&1);
		baseR |= (r & (1 << i));
	}
	for (int low = 0; low < (1 << 6); low++) {
		go.push_back(baseL | low);
		go.push_back(baseR | low);
	}
	sort(go.begin(),go.end());
	go.erase(unique(go.begin(),go.end()),go.end());
	mx.resize((int)go.size()*2);
}
void receiveA (bool x) {
	mx[ind] |= (((int)x) << bit);
	if ((++bit) > 14) {
		bit = 0; ++ind;
	}
}
int Answer () {
	int st = -1, ret = 0;
	for (int i = 0; i < (int)go.size(); i++) {
		if (go[i] == L) st = i;
	}
	for (int i = st; i < (int)go.size(); i++) {
		ret = max(ret,mx[2 * i]);
		if (go[i] == R) break;
		ret = max(ret,mx[2*i+1]);
	}
	return ret;
}

#include <bits/stdc++.h>
#include "Bruno.h"
using namespace std;
vector<int> go,mx,p,has(2); int ind = 0, bit = 14, N;
void InitB (int n, vector<int> pp) {
	p=pp;
}
void relay (int x) {
	for (int j = 0; j <= 14; j++) sendB(x >> j & 1);
}
void receiveB (bool x) {
	has[ind] |= (((int)x) << bit);
	if ((--bit) < 6) {
		bit = 14; ++ind;
	}
	if (ind > 1) {
		for (int low = 0; low < (1 << 6); low++) {
			go.push_back(has[0] | low);
			go.push_back(has[1] | low);
		}
		sort(go.begin(),go.end());
		go.erase(unique(go.begin(),go.end()),go.end());
		for (int i = 0; i < (int)go.size(); i++) {
			relay(p[i]);
			if (i + 1 < (int)go.size()) {
				int mx = 0;
				for (int j = go[i] + 1; j < go[i+1]; j++) mx = max(mx,p[j]);
				relay(mx);
			}
		}
	}
}

Compilation message

Anna.cpp: In function 'void InitA(int, int, int)':
Anna.cpp:10:3: error: 'sendA' was not declared in this scope; did you mean 'SendA'?
   10 |   sendA(l>>i&1);
      |   ^~~~~
      |   SendA
Anna.cpp:14:3: error: 'sendA' was not declared in this scope; did you mean 'SendA'?
   14 |   sendA(r>>i&1);
      |   ^~~~~
      |   SendA

Bruno.cpp: In function 'void relay(int)':
Bruno.cpp:9:32: error: 'sendB' was not declared in this scope; did you mean 'SendB'?
    9 |  for (int j = 0; j <= 14; j++) sendB(x >> j & 1);
      |                                ^~~~~
      |                                SendB