답안 #592599

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
592599 2022-07-09T10:35:24 Z errorgorn Flight to the Ford (BOI22_communication) C++17
0 / 100
32 ms 200 KB
#include"communication.h"

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define ii pair<int,int>
#define fi first
#define se second
#define endl '\n'

#define puf push_front
#define pof pop_front
#define pub push_back
#define pob pop_back
#define lb lower_bound
#define ub upper_bound

#define rep(x,s,e) for (int x=(s)-((s)>(e));x!=(e)-((s)>(e));((s)<(e))?x++:x--)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

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

std::pair<signed, signed> decode(signed N) {
	int t;
	int curr=0;
	while (true){
		t=receive();
		if (t==0) curr=(curr+1)%3;
		else break;
	}
	
	curr=(curr+receive())%3;
	return {(curr+1)%3+1,(curr+2)%3+1};
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 200 KB Not correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 32 ms 200 KB Not correct
2 Halted 0 ms 0 KB -