답안 #592619

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
592619 2022-07-09T11:05:18 Z errorgorn Flight to the Ford (BOI22_communication) C++17
15 / 100
38 ms 1876 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;
	
	X--;
    if (X==2){
		send(1);
		send(1);
		send(0);
	}
	else if (X==0){
		t=send(0);
		if (t==1) send(1);
		t=send(0);
		if (t==1) send(1);
		send(1);
		send(1);
		send(0);
	}
	else{
		t=send(0);
		if (t==1) send(0);
		t=send(0);
		if (t==1) send(0);
		t=send(0);
		if (t==1) send(1);
		t=send(0);
		if (t==1) send(1);
		send(1);
		send(1);
		send(0);
	}
}

std::pair<signed, signed> decode(signed N) {
	int t;
	int curr=0;
	while (true){
		t=receive();
		if (t==0) curr++;
		else break;
	}
	
	curr=(curr/2+receive())%3;
	//cout<<"debug: "<<curr<<endl;
	//cout<<(curr+1)%3+1<<" "<<(curr+2)%3+1<<endl;
	return {(curr+1)%3+1,(curr+2)%3+1};
}
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 1876 KB Output is correct
2 Correct 9 ms 1740 KB Output is correct
3 Correct 12 ms 1728 KB Output is correct
4 Correct 4 ms 1816 KB Output is correct
5 Correct 8 ms 1864 KB Output is correct
6 Correct 24 ms 1824 KB Output is correct
7 Correct 33 ms 1620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 38 ms 200 KB Not correct
2 Halted 0 ms 0 KB -