Submission #1177311

#TimeUsernameProblemLanguageResultExecution timeMemory
1177311ErJMessage (IOI24_message)C++20
0 / 100
181 ms844 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define vi vector<ll> #define vvi vector<vi> #define pp pair<ll, ll> #define vp vector<pp> #define inf 1000000000 #define vb vector<bool> vector<vb> ANS; std::vector<bool> send_packet(std::vector<bool> A); /* std::vector<bool> send_packet(std::vector<bool> A){ ANS.push_back(A); return A; } */ vb zero(31, false), one(31, true); void sendBit(bool x){ if(x) send_packet(one); else send_packet(zero); } void sendAll(vb C, vb M){ ll ind = 0; vb now = zero; ll Cind = 0; while(ind < M.size()){ if(Cind > zero.size()){ send_packet(now); now = zero; Cind = 0; }else{ if(C[Cind] == 1){ Cind++; }else{ now[Cind] = M[ind]; ind++; Cind++; } } } send_packet(now); now = zero; for(int i = 0; i < Cind; i++){ now[i] = 1; } send_packet(now); // end checker } void send_message(std::vector<bool> M, std::vector<bool> C){ for(int i = 0; i < C.size(); i++){ sendBit(C[i]); } sendAll(C, M); } bool getBit(vb packet){ ll ones = 0; ll zeros = 0; for(int i = 0; i < packet.size(); i++){ if(packet[i] == 0) zeros++; else ones++; } if(ones > zeros) return 1; else return 0; } std::vector<bool> receive_message(std::vector<std::vector<bool>> R){ vb ans; vb C(31); for(int i = 0; i < C.size(); i++){ C[i] = getBit(R[i]); } for(int i = C.size(); i < R.size() - 2; i++){ for(int j = 0; j < C.size(); j++){ if(C[j] == 0){ ans.push_back(R[i][j]); } } } for(int j = 0; j < C.size(); j++){ if((C[j] == 0) && (R.back()[j] == 1)){ ans.push_back(R[R.size() - 2][j]); } } /*for(int i = 0; i < R.size(); i++){ ans.push_back(getBit(R[i])); }*/ return ans; } /* int main(){ send_message({1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} ); vb gg = receive_message(ANS); for(int i = 0; i < gg.size(); i++){ cout << gg[i] << " "; } cout << '\n'; }*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...