Submission #1123653

#TimeUsernameProblemLanguageResultExecution timeMemory
1123653TobMessage (IOI24_message)C++20
100 / 100
551 ms848 KiB
#include <bits/stdc++.h> #include "message.h" #define F first #define S second #define all(x) x.begin(), x.end() #define pb push_back #define FIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0) using namespace std; typedef long long ll; typedef pair <ll, ll> pii; void send_message(vector<bool> M, vector<bool> C) { M.pb(1); while (M.size() < 1025) M.pb(0); int cur = 0; vector <int> a, wh(31); for (int i = 0; i < 31; i++) if (!C[i]) { wh[i] = a.size(); a.pb(i); } for (int i = 0; i < 66; i++) { vector <bool> A(31, 0); for (int j = 0; j < 31; j++) { if (C[j]) continue; int x = (a[(wh[j]+1)%16]-j+31)%31; if (i+1 < x) continue; if (i+1 == x) A[j] = 1; if (i+1 > x) A[j] = M[cur++]; } send_packet(A); } } vector<bool> receive_message(vector<vector<bool>> R) { vector <int> a(31), c; for (int i = 0; i < 31; i++) { a[i] = 66; for (int j = 0; j < 66; j++) if (R[j][i]) { a[i] = j+1; break; } } for (int i = 0; i < 31; i++) { int x = i; for (int j = 0; j < 16; j++) { if (a[x] > 16) { x = -1; break; } x = (x+a[x])%31; if (x == i && j < 15) { x = -1; break; } } if (x == i) { for (int j = 0; j < 16; j++) { c.pb(x); x = (x+a[x])%31; } break; } } vector <bool> res; for (int i = 0; i < 66; i++) { for (auto j : c) { if (i+1 <= a[j]) continue; res.pb(R[i][j]); } } while (res.back() == 0) res.pop_back(); res.pop_back(); return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...