# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
823795 | Amylopectin | Flight to the Ford (BOI22_communication) | C++17 | 34 ms | 1692 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include"communication.h"
#include <stdio.h>
#include <iostream>
#include <vector>
#include <stdlib.h>
#include <time.h>
using namespace std;
const int mxn = 510,lo = 2,see = 76789;
int dran[mxn] = {};
void encode(int n, int x)
{
int i,j,cn,cm,fn,fm,cou = 0,cret,csta;
srand(see);
for(i=0; i<410; i++)
{
if(rand() %3 == 2)
{
dran[i] = 1;
}
else
{
dran[i] = 0;
}
}
for(i=0; i<lo; i++)
{
if((1<<i) & x)
{
cn = 1;
}
else
{
cn = 0;
}
// cm = (cn + dran[cou]) & 1;
cou ++;
cret = send(cn);
if(cret == cn)
{
csta = 0;
}
else
{
csta = 1;
}
while(1)
{
// cm = (cn + dran[cou]) & 1;
if(dran[cou] == 0)
{
cou ++;
cret = send(cn);
if(csta == 0)
{
if(cret == cn)
{
break;
}
}
csta = (csta + 1) & 1;
}
else
{
cou ++;
cm = (cret + 1) & 1;
cret = send(cm);
if(cret != cm)
{
break;
}
cou ++;
cret = send(cn);
if(cret == cn)
{
csta = 0;
}
else
{
csta = 1;
}
}
}
}
return ;
}
std::pair<int, int> decode(int n)
{
int i,j,m,cn,cm,fn,fm,cva = 0,be,cou = 0;
srand(see);
for(i=0; i<410; i++)
{
if(rand() %3 == 2)
{
dran[i] = 1;
}
else
{
dran[i] = 0;
}
}
for(i=0; i<lo; i++)
{
be = receive();
cou ++;
while(1)
{
cn = receive();
if(cn == be)
{
cva += (cn<<i);
cou ++;
break;
}
be = cn;
if(dran[cou] == 1)
{
be = receive();
cou ++;
}
cou ++;
}
}
return {cva,cva};
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |