This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include"communication.h"
#include <vector>
using namespace std;
void encode(int N, int X) {
if (X == 1) { send(0); send(0); send(0); send(0); send(0); send(0); }
if (X == 2) { send(1); send(1); send(1); send(1); send(1); send(1); }
if (X == 3) { send(1); send(1); send(0); send(0); send(1); send(1); }
}
pair<int, int> decode(int N) {
vector<int> List;
List.push_back(receive());
List.push_back(receive());
List.push_back(receive());
List.push_back(receive());
List.push_back(receive());
List.push_back(receive());
// Check
bool flag1 = true;
bool flag2 = true;
for (int i = 0; i < (int)List.size() - 1; i++) {
if (List[i] == 1 && List[i + 1] == 1) flag1 = false;
if (List[i] == 0 && List[i + 1] == 0) flag2 = false;
}
if (flag1 == false) return make_pair(2, 3);
if (flag2 == false) return make_pair(1, 3);
return make_pair(1, 2);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |