Submission #1298002

#TimeUsernameProblemLanguageResultExecution timeMemory
1298002bangchanMessage (IOI24_message)C++20
0 / 100
138 ms804 KiB
#include "message.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<bool> vb; typedef vector<double> vd; typedef vector<string> vs; typedef vector<char> vc; typedef vector<vi> vvi; typedef pair<int,int> pii; typedef vector<pii> vii; typedef map<int, int> mii; typedef vector<vl> vvl; typedef pair<ll, ll> pll; typedef vector<pll> vpl; #define F first #define S second #define yes cout << "YES" << endl #define no cout << "NO" << endl #define pb push_back #define forn(i, x, n) for (ll i = x; i < ll(n); i++) #define fornl(i, x, n) for(ll i = x; i >= ll(n); i--) #define all(x) x.begin(), x.end() #define mod 1000000007 #define inf 10000000000000 void send_message(vector<bool> M, vector<bool> C) { vb a(31, 0); vl idx; ll cl = 0; forn(i, 0, 31){ forn(j, 0, 31) a[j] = C[i]; if(!C[i]){idx.pb(i); cl += (i < 19);} if(i < 19) send_packet(a); } if(cl > 4){ ll h = 19; while(h < 31){ a.assign(31, 0); ll x = 0; for(ll i = 0; i < cl && h < 31; i++){ if(C[h] == 0) x++; a[idx[i]] = C[h]; h++; } cl += x; send_packet(a); } } vb b(31, 0); forn(i, 0, 11){ b[idx[i]] = (b.size() & (1 << i)) != 0; } send_packet(b); ll t = 0; for(ll i = 0; i < (M.size() + 15) / 16; i++){ //+= 16 ll p = 0; forn(j, 0, 16) a[idx[p]] = M[t]; p++; t++; send_packet(a); } } vector<bool> receive_message(vector<vector<bool>> R) { vl idx; forn(i, 0, 19){ ll qo = 0, qn = 0; forn(j, 0, R[i].size()){ if(R[i][j]) qn++; else qo++;} if(qo > qn) idx.pb(i); } ll x = 19, cl = idx.size(); if(cl > 4){ ll h = 19; while(h < 31){ cl = idx.size(); for(ll i = 0; i < cl && h < 31; i++){ if(!R[x][idx[i]]) idx.pb(h); h++; } x++; } } else { forn(j, 19, 31) idx.pb(j); } ll y = 0; forn(i, 0, 11) if(R[x][idx[i]]) y += (1 << i); x++; vb an(y); ll t = 0; for(ll i = 0; i < (y + 15) / 16; i++){ //+= 16 ll p = 0; forn(j, 0, 16){ an[t] = R[x][idx[p]]; p++; t++; } x++; } return an; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...