| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1335929 | modwwe | 메시지 (IOI24_message) | C++20 | 0 ms | 0 KiB |
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
void send_message(std::vector<bool> M, std::vector<bool> C)
{
vector<int> hihi;
vector<bool>send[66];
for(int i=0; i<66; i++)send[i].resize(31);
for(int i=0; i<C.size(); i++)
if(C[i]==0)hihi.pb(i);
int x=1-M.back();
while(M.size()<1025)M.pb(x);
int dem=0;
int s=0;
for(int i=0; i<hihi.size(); i++)
{
int j=0;
int x=hihi[i];
if(i<hihi.size()-1)j=hihi[i+1]-hihi[i];
else j=hihi[0]+31-hihi[i];
send[j-1][x]=1;
s+=j;
for(int t=j; t<66; t++){
send[t][x]=M[dem++];
}
}
for(int i=0; i<66; i++)
send_packet(send[i]);
}
vector<bool> receive_message(std::vector<std::vector<bool>> d)
{
int cx[31];
for(int i=0;i<31;i++)cx[i]=0;
for(int i=0; i<66; i++)
{
for(int j=0; j<31; j++)
if(d[i][j]==1&&cx[j]==0)
cx[j]=i+1+j;
}
vector<int> cr;
for(int i=2; i<31; i++)
if(cx[i]!=0)
{
int x=i;
int dem=1;
while(dem<=16)
{
x=cx[x];
if(x>30)x-=31;
if(x==i)break;
dem++;
}
if(dem==16)cr.pb(i);
}
vector<bool> haha;
for(auto x:cr)
{
bool ok=0;
for(int i=0; i<66; i++)
{
if(ok)haha.pb(d[i][x]);
if(d[i][x])ok=1;
}
}
int lx=haha.back();
while(haha.back()==lx)haha.pop_back();
return haha;
}
