Submission #1335930

#TimeUsernameProblemLanguageResultExecution timeMemory
1335930modwweMessage (IOI24_message)C++20
0 / 100
351 ms816 KiB
#include<bits/stdc++.h>
#include "message.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;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...