제출 #1337927

#제출 시각아이디문제언어결과실행 시간메모리
1337927aritro_Message (IOI24_message)C++20
0 / 100
469 ms816 KiB
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
#define endl '\n'
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(),a.end()

void send_message(vector<bool>M,vector<bool>C);

int xyz=90;

vector<bool> receive_message(vector<vector<bool>>R){
    map<int,bool> chk;
    for(int i=0;i<31;i++) chk[i]=1;
    int n=R.size();
    for(int i=0;i<xyz;i++) for(int j=0;j<31;j++) chk[j]&=R[i][j];
    vector<bool> ans;
    for(int i=xyz;i<n-2;i++){
        for(int j=0;j<31;j++){
            if(chk[j]) ans.pb(R[i][j]);
        }
    }
    for(int i=0;i<31;i++) chk[i]&=R[n-2][i];
    //for(int i=0;i<31;i++) cout<<chk[i]<<' ';
    //cout<<endl;
    for(int i=0;i<31;i++){
        if(chk[i]){
            ans.pb(R[n-1][i]);
        }
    }
    return ans;
}

vector<bool> send_packet(vector<bool> A);

void send_message(vector<bool>M,vector<bool>C){
    int n=31;
    vector<bool> send(31);
    for(int i=0;i<31;i++) send[i]=1;
    for(int i=0;i<xyz;i++) send_packet(send);
    int ind=0;
    while(ind+16<M.size()){
        for(int i=0;i<31&&ind<M.size();i++){
            if(C[i]==0){
                send[i]=M[ind];
                ind++;
            }
        }
        send_packet(send);
    }
    int tem=ind;
    for(int i=0;i<31;i++){
        if(!C[i]&&ind<M.size()){
            send[i]=1;
            ind++;
        }
        else send[i]=0;
    }
    send_packet(send);
    for(int i=0;i<31;i++){
        if(!C[i]&&tem<M.size()){
            send[i]=M[tem];
            tem++;
        }
        else send[i]=0;
    }
    send_packet(send);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...