Submission #1190061

#TimeUsernameProblemLanguageResultExecution timeMemory
1190061epicci23Message (IOI24_message)C++20
0 / 100
190 ms844 KiB
#include "bits/stdc++.h"
#include "message.h"
//#define int long long
#define all(v) v.begin() , v.end()
#define sz(a) (int)a.size()
using namespace std;

bool cogunluk(vector<bool> cur){
  int hm1 = count(all(cur), 1);
  int hm0 = count(all(cur), 0);
  if(hm0 > hm1) return 0;
  return 1;
}

void send_message(vector<bool> M, vector<bool> C) {
  vector<bool> A(31, 0);
  for(int i = 0; i < 30; i++){
    if(C[i] == 0) A.assign(31, 0);
    else A.assign(31, 1);
    send_packet(A);
  }
  
  int ptr = 0;

  for(int i = 0; i < (sz(M) + 15) / 16; i++){
  	A.assign(31, 0);
    for(int j = 0; j < 31; j++){
      if(C[j] == 0) A[j] = M[ptr++];
    }
    send_packet(A);
  }
}

vector<bool> receive_message(vector<vector<bool>> R){
  vector<bool> C(31, 0);
  int kac0 = 0;
  for(int i = 0; i < 30; i++){ // gercek info veren bitleri ogren
    C[i] = cogunluk(R[i]);
    if(!C[i]) kac0++;
  }
  
  if(kac0 == 15) C[30] = 0;
  else C[30] = 1; 

  vector<bool> res;

  for(int i = 30; i < sz(R); i++){
    for(int j = 0; j < 31; j++){
      if(C[j] == 0){
        res.push_back(R[i][j]);
      }
    }
  }

  return res;
}


/*void _(){
	
}

int32_t main(){
  cin.tie(0); ios::sync_with_stdio(0);
  int tc=1;//cin >> tc;
  while(tc--) _();
  return 0;
}*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...