| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1311903 | eri16 | 메시지 (IOI24_message) | C++20 | 0 ms | 0 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);}
}
}
