Submission #1297888

#TimeUsernameProblemLanguageResultExecution timeMemory
1297888scalifrastico_098Message (IOI24_message)C++20
0 / 100
44 ms804 KiB
#include "message.h"
#include <bits/stdc++.h>
using namespace std;
void send_message(vector<bool> s, vector<bool> c) {
  int ij=s.size(), ik=31; vector<bool> k(ij), l; 
  for(int i=0; i<ij; i++){if(!c[i])k.push_back(i);}
  vector<bool> p1(31, true), p2(31, false); send_packet(p1); 
  send_packet(p2);
  for(int b=0; b<10; b++){l.push_back((ij>>b)&1);} 
  for(auto x:s)l.push_back(x);
  int yr=0;
  while(yr<l.size())
  { 
    vector<bool> a(31, 0);
    for(int b=0; b<16&&yr<l.size(); b++)
    {
      a[k[b]]=l[yr]; yr++;
    }
    send_packet(a);
  }
}
vector<bool> receive_message(vector<vector<bool>> r) {
  vector<bool> a, n; int ij=r.size(), i=0; 
  vector<bool> u=r[0], v=r[1]; vector<int> k;
  for(int i=0; i<31; i++)
  {
    if(!u[i]&&v[i]){k.push_back(i);}
  }
  for(int i=2; i<ij; i++)
  {
    for(auto x: k){a.push_back(r[i][x]);}
  }
  int y=0;for(int i=0; i<10; i++){if(y|=(1<<i));}
  vector<bool> j(y); for(int i=0; i<y; i++)j[i]=a[10+i];
  return a; 
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...