Submission #1188501

#TimeUsernameProblemLanguageResultExecution timeMemory
1188501qwushaFlight to the Ford (BOI22_communication)C++20
15 / 100
462 ms2920 KiB
#include <bits/stdc++.h> using namespace std; #define fi first #define se second typedef long long ll; typedef long double ld; mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count()); #include"communication.h" void encode(int n, int x) { if (x == 2) { int last = 0; for (int i = 0; i < 250; i++) { int va = send(last); last = va; } } else if (x == 1) { for (int i = 0; i < 250; i++) { int va = send(0); } } else { for (int i = 0; i < 250; i++) { int va = send(1); } } } pair<int, int> decode(int n) { bool one = 0; bool zer = 0; int prev = -1; for (int i = 0; i < 250; i++) { int va = receive(); if (va == 1 && prev == 1) one = 1; if (va == 0 && prev == 0) { zer = 1; } prev = va; } if (one) { return {2, 3}; } else if (zer) { return {1, 2}; } else { return {1, 3}; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...