Submission #1334778

#TimeUsernameProblemLanguageResultExecution timeMemory
1334778hoangnoobproMessage (IOI24_message)C++20
0 / 100
188 ms820 KiB
#include<bits/stdc++.h>
#include "message.h"
using namespace std;
#define mod 1000000007
#define nmax 1000007
#define fi first
#define se second
#define ll int
ll t=1,n,m,i,j,k,x=0,d=0,y,z,t1,t2,t3,sz;
void send_message(vector<bool> M, vector<bool> C)
{
    vector<bool>hi,hi1;
    for(int i=0;i<31;++i)
    {
        hi.clear();
        for(int j=0;j<31;++j)hi.push_back(C[i]);
        hi1=send_packet(hi);
    }
    M.push_back(1);
//    hi.clear();
//    t1=M.size();
//    for(int i=0;i<31;++i)
//    {
//        if(C[i]==1)hi.push_back(0);
//        else
//        {
//            hi.push_back(t1%2);
//            t1/=2;
//        }
//    }
//    hi1=send_packet(hi);
    for(int i=0;i<M.size();)
    {
        t1=i;
        hi.clear();
        for(int j=0;j<31;++j)
        {
            if(C[j]==1)hi.push_back(0);
            else
            {
                if(t1<M.size())hi.push_back(M[t1]);
                else hi.push_back(0);
                t1++;
            }
        }
        hi1=send_packet(hi);
        i=t1;
    }
}
vector<bool> receive_message(vector<vector<bool>> R)
{
    vector<bool>ans,ans1;
    vector<bool>error;
    for(int i=0;i<31;++i)
    {
        t1=0;
        for(int j=0;j<31;++j)
        {
            t1+=R[i][j];
        }
        if(t1>=16)error.push_back(1);
        else error.push_back(0);
    }
//    sz=0;
//    t1=0;
//    for(int i=0;i<31;++i)
//    {
//        if(!error[i])
//        {
//            if(R[31][i])sz+=(1<<t1);
//            t1++;
//        }
//    }
//    t1=0;
    for(int i=32;i<R.size();++i)
    {
        for(j=0;j<31;++j)
        {
            if(!error[j])
            {
//                t1++;
                ans.push_back(R[i][j]);
//                if(t1==sz)break;
            }
        }
        if(t1==sz)break;
    }
    for(int i=0;i<ans.size();++i)
    {
        if(ans[i]==1)t1=i;
    }
    for(int i=0;i<t1;++i)ans1.push_back(ans[i]);
    return ans1;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...