Submission #578303

#TimeUsernameProblemLanguageResultExecution timeMemory
578303IvanJFlight to the Ford (BOI22_communication)C++17
15 / 100
35 ms1924 KiB
#include"communication.h" #include<bits/stdc++.h> #define pb push_back #define x first #define y second #define all(a) (a).begin(), (a).end() using namespace std; typedef long long ll; typedef pair<int, int> ii; // // --- 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) { int r; if(X == 1) { send(1); send(0); send(0); } if(X == 2) { send(0); send(1); send(0); } if(X == 3) { r = send(0); if(r == 0) send(1); else send(0); send(1); } } ii decode(int N) { int a = receive(); int b = receive(); int c = receive(); if(a == 0 && b == 0 && c == 0) return {1, 2}; if(a == 0 && b == 0 && c == 1) return {1, 3}; if(a == 0 && b == 1 && c == 0) return {2, 3}; if(a == 0 && b == 1 && c == 1) return {2, 3}; if(a == 1 && b == 0 && c == 0) return {1, 3}; if(a == 1 && b == 0 && c == 1) return {1, 3}; if(a == 1 && b == 1 && c == 0) return {1, 2}; if(a == 1 && b == 1 && c == 1) return {2, 2}; }

Compilation message (stderr)

communication.cpp: In function 'ii decode(int)':
communication.cpp:57:1: warning: control reaches end of non-void function [-Wreturn-type]
   57 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...