Submission #1132994

#TimeUsernameProblemLanguageResultExecution timeMemory
1132994PagodePaivaFlight to the Ford (BOI22_communication)C++20
15 / 100
10 ms2848 KiB
#include<bits/stdc++.h> #include"communication.h" using namespace std; // // --- 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 = receive(); if(x == 1){ x = receive(); if(x == 1) return {1, 2}; } int y = receive(); int z = receive(); 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:53:1: warning: control reaches end of non-void function [-Wreturn-type]
   53 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...