Submission #1198819

#TimeUsernameProblemLanguageResultExecution timeMemory
1198819viduxMessage (IOI24_message)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; //#define LOCAL #define FOR(i, n) for (int i = 0; i < n; ++i) #define REP(i, n, m) for (int i = n; i <= m; ++i) #define REPR(i, n, m) for (int i = n; i >= m; --i) #define FORR(x, a) for (auto& x : a) #define FORR2(x, y, a) for (auto& [x, y] : a) #define ALL(x) (x).begin(), (x).end() #define RALL(x) (x).rbegin(), (x).rend() #define SZ(a) ((int)a.size()) typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<bool> vb; typedef vector<vi> vvi; typedef vector<vl> vvl; typedef vector<vb> vvb; const int INF = 1e9; const ll LLINF = 1e18; const int N = 31; #ifdef LOCAL vb LOCAL_C; vvb R; std::vector<bool> send_packet(std::vector<bool> A) { vb ret(N); FOR(i, N) if (LOCAL_C[i]) ret[i] = rand() % 2; else ret[i] = A[i]; //cout << "sending: "; FOR(i, N) cout << ret[i] << " "; cout << endl; R.push_back(ret); //if (SZ(R) == 31) cout << endl; return ret; } #endif void send_message(std::vector<bool> M, std::vector<bool> C) { int sent = 0; #ifdef LOCAL LOCAL_C = C; #endif FOR(i, N) { vb a(N); FOR(j, N) a[j] = C[i]; send_packet(a); sent++; } vi idxs; FOR(i, N) if (!C[i]) idxs.push_back(i); vb curM(31); int im = 0, icm = 0; while (im < SZ(M)) { curM[idxs[icm]] = M[im++]; icm = (icm + 1) % 16; if (icm == 0) send_packet(curM), sent++; } if (icm != 0) send_packet(curM), sent++; while (sent < 99) send_packet(curM), sent++; int sz = SZ(M); curM = vb(N); FOR(i, 11) curM[idxs[i]] = sz & (1 << i); send_packet(curM); } std::vector<bool> receive_message(std::vector<std::vector<bool>> R) { vb C(N); FOR(i, N) { int cnt[2] = {0}; FOR(j, N) cnt[R[i][j]]++; if (cnt[0] >= 16) C[i] = 0; else C[i] = 1; } vi idxs; FOR(i, N) if (!C[i]) idxs.push_back(i); int sz = 0; FOR(i, 11) sz |= (1 << i) * R.back()[idxs[i]]; //cout << "sz: " << sz << endl; vb ans; REP(i, N, 99) { vb seg(16); FOR(j, 16) seg[j] = R[i][idxs[j]]; //cout << "read: "; FOR(j, 16) cout << seg[j] << " "; cout << endl; FOR(j, 16) { ans.push_back(seg[j]); if (SZ(ans) == sz) break; } if (SZ(ans) == sz) break; } #ifdef LOCAL //cout << "sz: " << sz << endl; //cout << "ans: "; //FOR(i, SZ(ans)) cout << ans[i] << " "; cout << endl; #endif return ans; } #ifdef LOCAL int main() { int t; cin >> t; while (t--) { R.clear(); int n; cin >> n; vb a(n); FOR(i, n) { int x; cin >> x; a[i] = x; } vb c(N); FOR(i, N) { int x; cin >> x; c[i] = x; } send_message(a, c); vb ans = receive_message(R); FOR(i, SZ(ans)) cout << ans[i] << " "; cout << endl; } return 0; } #endif

Compilation message (stderr)

message.cpp: In function 'void send_message(std::vector<bool>, std::vector<bool>)':
message.cpp:52:17: error: 'send_packet' was not declared in this scope
   52 |                 send_packet(a);
      |                 ^~~~~~~~~~~
message.cpp:62:31: error: 'send_packet' was not declared in this scope
   62 |                 if (icm == 0) send_packet(curM), sent++;
      |                               ^~~~~~~~~~~
message.cpp:64:23: error: 'send_packet' was not declared in this scope
   64 |         if (icm != 0) send_packet(curM), sent++;
      |                       ^~~~~~~~~~~
message.cpp:65:27: error: 'send_packet' was not declared in this scope
   65 |         while (sent < 99) send_packet(curM), sent++;
      |                           ^~~~~~~~~~~
message.cpp:69:9: error: 'send_packet' was not declared in this scope
   69 |         send_packet(curM);
      |         ^~~~~~~~~~~