Submission #592778

# Submission time Handle Problem Language Result Execution time Memory
592778 2022-07-09T15:24:11 Z rainboy Flight to the Ford (BOI22_communication) C++17
15 / 100
39 ms 1716 KB
#include "communication.h"

using namespace std;

typedef pair<int, int> pi;

void encode(int n, int a) {
	if (send(a == 1 ? 0 : 1) == 1 && send(a == 2 || a == 3 ? 0 : 1) == 0)
		return;
	send(a == 1 || a == 2 ? 0 : 1);
}

pi decode(int n) {
	if (receive() == 1 && receive() == 0)
		return {2, 3};
	return receive() == 0 ? make_pair(1, 2) : make_pair(1, 3);
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1696 KB Output is correct
2 Correct 9 ms 1716 KB Output is correct
3 Correct 9 ms 1664 KB Output is correct
4 Correct 8 ms 1668 KB Output is correct
5 Correct 9 ms 1668 KB Output is correct
6 Correct 18 ms 1708 KB Output is correct
7 Correct 39 ms 1640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 200 KB Not correct
2 Halted 0 ms 0 KB -