# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1103074 | aaaaaarroz | Message (IOI24_message) | C++17 | 1748 ms | 1240 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
vector<bool> send_packet(vector<bool> A);
void send_message(vector<bool> M, vector<bool> C){
for(int i=0;i<31;i++){
if(C[i]==true){
vector<bool>paquete(31,0);
send_packet(paquete);
}
else{
vector<bool>paquete(31,1);
send_packet(paquete);
}
}
vector<bool>numero(31,0);
int bit_real=0;
for(int i=0;i<31;i++){
if(C[i]==1){
continue;
}
if(((1<<bit_real)&(M.size()))){
numero[i]=1;
}
bit_real++;
}
send_packet(numero);
vector<bool>envio;
int pos=0;
while(pos<M.size()){
if(C[envio.size()]==0){
envio.push_back(M[pos]);
pos++;
}
else{
envio.push_back(0);
}
if(envio.size()==31){
send_packet(envio);
envio.clear();
}
}
while(envio.size()<31){
envio.push_back(false);
if(envio.size()==31){
send_packet(envio);
break;
}
}
}
vector<bool> receive_message(vector<vector<bool>> R){
vector<bool>funciona(31,false);
for(int i=0;i<31;i++){
int votos=0;
for(int j=0;j<31;j++){
if(R[i][j]){
votos++;
}
}
if(votos>15){
funciona[i]=true;
}
}
int bit_real=0;
int largo=0;
for(int j=0;j<31;j++){
if(funciona[j]){
if(R[31][j]){
largo+=(1<<bit_real);
}
bit_real++;
}
}
vector<bool>sec;
for(int i=32;i<R.size();i++){
for(int j=0;j<31;j++){
if(funciona[j]){
sec.push_back(R[i][j]);
}
}
}
while(sec.size()>largo){
sec.pop_back();
}
return sec;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |