Submission #1132992

#TimeUsernameProblemLanguageResultExecution timeMemory
1132992PagodePaivaFlight to the Ford (BOI22_communication)C++20
Compilation error
0 ms0 KiB
#include"communication.h"
//
// --- Sample implementation for the task communication ---
//
// To compile this program with the sample grader, place:
//     communication.h communication_sample.cpp sample_grader.cpp
// in a single folder, then open the terminal in this directory (right-click onto an empty spot in the directory,
// left click on "Open in terminal") and enter e.g.:
//     g++ -std=c++17 communication_sample.cpp sample_grader.cpp
// in this folder. This will create a file a.out in the current directory which you can execute from the terminal
// as ./a.out
// See task statement or sample_grader.cpp for the input specification
//

void encode(int n, int x) {
	if(n == 3){
		if(x == 1 or x == 2){
			int t = send(1);
			if(t == 1){
				t = send(1);
				if(t == 1) return;
			} 
		}
		else{
			int t = send(0);
			if(t == 1){
				t = send(0);
			}
		}
	}
	if(x == 1 or x == 3) send(1);
	else send(0);
	if(x == 2 or x == 3) send(1);
	else send(0);
}

std::pair<int, int> decode(int N) {
    int x = recieve();
    if(x == 1){
    	x = recieve();
    	if(x == 1) return {1, 2};
    }
    int y = recieve();
    int z = recieve();
    if(y == 0 and z == 0) return {1, 2};
    if(y == 0 and z == 1) return {2, 3};
    if(y == 1 and z == 0) return {1, 3};
    if(y == 1 and z == 1) return {1, 3};
}

Compilation message (stderr)

communication.cpp: In function 'std::pair<int, int> decode(int)':
communication.cpp:38:13: error: 'recieve' was not declared in this scope; did you mean 'receive'?
   38 |     int x = recieve();
      |             ^~~~~~~
      |             receive
communication.cpp:49:1: warning: control reaches end of non-void function [-Wreturn-type]
   49 | }
      | ^