Submission #592487

# Submission time Handle Problem Language Result Execution time Memory
592487 2022-07-09T08:58:47 Z tqbfjotld Flight to the Ford (BOI22_communication) C++17
15 / 100
32 ms 1804 KB
#include"communication.h"
#include <bits/stdc++.h>
using namespace std;

void encode(int N, int X) {
    if (X==1){
		int t1 = send(0);
		if (t1==0){
			send(0);
			send(1);
		}
		else{
			send(1);
			send(0);
		}
	}
	if (X==2){
		send(1);
		send(1);
		send(1);
	}
	if (X==3){
		send(0);
		send(0);
		send(0);
	}
}

std::pair<int, int> decode(int N) {
    int t1 = receive();
    int t2 = receive();
    int t3 = receive();
    if (t1==0 && t2==0) return {1,3};
    if (t1==1 && t2==1) return {1,2};
    if (t1==0 && t2==1 && t3==1) return {1,2};
    if (t1==0 && t2==1 && t3==0) return {2,3};
    if (t1==1 && t2==0) return {2,3};
    return {1337, 42};
}
# Verdict Execution time Memory Grader output
1 Correct 12 ms 1804 KB Output is correct
2 Correct 12 ms 1680 KB Output is correct
3 Correct 17 ms 1780 KB Output is correct
4 Correct 7 ms 1680 KB Output is correct
5 Correct 12 ms 1796 KB Output is correct
6 Correct 23 ms 1804 KB Output is correct
7 Correct 32 ms 1672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 200 KB Not correct
2 Halted 0 ms 0 KB -