Submission #742444

# Submission time Handle Problem Language Result Execution time Memory
742444 2023-05-16T09:20:43 Z jamielim Flight to the Ford (BOI22_communication) C++17
15 / 100
38 ms 1748 KB
#include "communication.h"
#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define ALL(x) x.begin(),x.end()
#define SZ(x) (int)x.size()
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ii,ii> i4;
typedef vector<int> vi;
const int MOD=1000000007;
const int INF=1012345678;
const ll LLINF=1012345678012345678LL;
const double PI=3.1415926536;
const double EPS=1e-14;

void encode(int N, int X) {
	if(X==1){
		int x=send(0);
		if(x==0){
			int y=send(0);
			if(y==0){
				send(0); // 00x
			}else{
				send(0); // 010
			}
		}else{
			send(0);
			send(0); // 10x
		}
	}else if(X==2){
		int x=send(0);
		if(x==0){
			int y=send(0);
			if(y==0){
				send(0); // 00x
			}else{
				send(1); // 011
			}
		}else{
			send(1);
			send(1); // 11x
		}
	}else{
		int x=send(1);
		if(x==1){
			int y=send(0);
			if(y==0){
				send(0); // 10x
			}else{
				send(0); // 110
			}
		}else{
			send(1);
			send(1); // 01x
		}
	}
}

pair<int, int> decode(int N) {
	int x=receive();
	int y=receive();
	int z=receive();
	if(x==0&&y==0)return {1,2};
	if(x==0&&y==1&&z==1)return {2,3};
	if(x!=y)return {1,3};
	return {2,3};
}
/*
000  1 2
001  1 2
010  1 3
011  2 3
100  1 3
101  1 3
110  2 3
111  2
*/
# Verdict Execution time Memory Grader output
1 Correct 13 ms 1652 KB Output is correct
2 Correct 11 ms 1748 KB Output is correct
3 Correct 20 ms 1744 KB Output is correct
4 Correct 9 ms 1660 KB Output is correct
5 Correct 12 ms 1700 KB Output is correct
6 Correct 21 ms 1748 KB Output is correct
7 Correct 38 ms 1668 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 200 KB Not correct
2 Halted 0 ms 0 KB -