Submission #1311905

#TimeUsernameProblemLanguageResultExecution timeMemory
1311905eri16Message (IOI24_message)C++20
0 / 100
486 ms804 KiB
#include <bits/stdc++.h>
#include "message.h"
using namespace std;

using ll = long long;

void send_message(vector<bool> M, vector<bool> C){
    
    ll n = C.size();
    
    vector <bool> truth(31,true);
    vector <bool> lie(31,false);    
    
    ll index=-1;
    
    for (int i=0; i<31; i++){
        if (C[i]){send_packet(lie);}
        else{send_packet(truth);index=i;}
    }
    
    for (int i=0; i<M.size(); i++){
        vector <bool> ans = lie;
        ans[index]=true;
        send_packet(ans);
    }
}

vector<bool> receive_message(vector<vector<bool>> R){
    ll idx=-1;
    for (int i=0; i<31; i++){
        ll sm = 0;
        for (int j=0; j<31; j++){
            if (R[i][j]){sm++;}
        }
        if (sm>=16){idx=i;}
    }
    vector <bool> ans;
    for (int i=31; i<R.size(); i++){
        if (R[i][idx]){ans.push_back(true);}
        else{ans.push_back(false);}
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...