제출 #1123647

#제출 시각아이디문제언어결과실행 시간메모리
1123647raphaelp메시지 (IOI24_message)C++20
0 / 100
497 ms832 KiB
#include <bits/stdc++.h> #include "message.h" using namespace std; void send_message(vector<bool> M, vector<bool> C) { vector<int> dist(31); int last = 0, first = -1; for (int i = 0; i < 31; i++) { if (C[i] == 0) { if (first == -1) first = i; dist[last] = i - last; last = i; } } dist[first] = 31 + first - last; int buff = 0; vector<bool> A(31); for (int i = 0; i < 66; i++) { A.assign(31, 0); for (int j = 0; j < 31; j++) { if (C[j] == 0) { if (dist[j] == 0) A[j] = 1; if (dist[j] >= 0) dist[j]--; else if (buff < M.size()) A[j] = M[buff++]; else if (buff == M.size()) { A[j] = 1; buff++; } } } vector<bool> temp = send_packet(A); } } vector<bool> receive_message(vector<vector<bool>> R) { vector<int> dist(31); for (int i = 0; i < 31; i++) { for (int j = 0; R[j][i] == 0; j++) dist[i]++; } vector<int> C(31), occ(31); int good = -1; for (int i = 0; i < 31; i++) { if (good != -1) break; if (occ[i]) continue; int x = i, len = 1; while (occ[x] == 0) { occ[x] = len; x = (x + dist[x]) % 31; } if (len - occ[x] == 16) good = x; } for (int i = 0; i < 16; i++) { C[good] = 1; good = (good + dist[good]) % 31; } vector<bool> ans; for (int i = 0; i < 66; i++) { for (int j = 0; j < 31; j++) { if (C[j] == 0) continue; if (dist[j] >= i) continue; ans.push_back(R[i][j]); } } while (ans.back() == 0) ans.pop_back(); ans.pop_back(); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...