QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#562678#9237. Message0000pncCompile Error//C++141.5kb2024-09-13 20:00:392024-09-13 20:00:39

Judging History

你现在查看的是最新测评结果

  • [2024-09-13 20:00:39]
  • 评测
  • [2024-09-13 20:00:39]
  • 提交

answer

#include <bits/stdc++.h>
#include "message.h"
using namespace std;

void send_message(vector<bool> M, vector<bool> C) {
	vector<int> pos, d(31, 0);
	vector<vector<bool> > all(66, vector<bool>(16, 0));
	for (int i = 0; i < 31; i++) {
		if (!C[i]) pos.push_back(i);
	}
	for (int i = 0; i < 15; i++) d[pos[i]] = pos[i + 1] - pos[i];
	d[pos[15]] = pos[0] + 31 - pos[15];
	vector<bool> msg;
	for (bool x : M) msg.push_back(x);
	msg.push_back(true);
	while (msg.size() != 1025) msg.push_back(false);
	for (int i = 0, cur = 0; i < 66; i++) {
		for (int j = 0; j < 31; j++) {
			if (!C[j]) {
				if (i < d[j]) {
					if (i == d[j] - 1) all[i][j] = 1;
					else all[i][j] = 0;
				}
				else all[i][j] = msg[++cur];
			}
		}
	}
	for (int i = 0; i < 66; i++) {
		vector<bool> useless = send_packet(all[i]);
	}
}

vector<bool> receive_message(vector<vector<bool> > R) {
	vector<int> d(31, 0), to(31, 0);
	for (int i = 0; i < 31; i++) {
		for (int j = 0; j < 66; j++) {
			if (R[i][j]) { d[i] = j + 1; break; }
		}
		d[i] = min(d[i], 31);
		to[i] = (i + d[i]) % 31;
	}
	vector<bool> vis(31, false);
	for (int i = 0; i < 31; i++) {
		int cnt = 1, res = to[i];
		while (res != i) res = to[res], cnt++;
		if (cnt == 16) {
			res = to[i]; vis[i] = true;
			while (!vis[res]) vis[res] = 1, res = to[res];
		}
	}
	vector<bool> msg;
	for (int i = 0; i < 66; i++) {
		for (int j = 0; j < 31; j++) {
			if (vis[j] && i >= d[j]) {
				msg.push_back(R[i][j]);
			}
		}
	}
	while (msg.back() != true) msg.pop_back();
	msg.pop_back(); return msg;
}

详细

stub.cpp: In function ‘int {anonymous}::sz(const C&)’:
stub.cpp:27:52: error: ‘size’ is not a member of ‘std’; did you mean ‘size_t’?
   27 | template<class C> int sz(const C& c) { return std::size(c); }
      |                                                    ^~~~
      |                                                    size_t
stub.cpp: In function ‘void {anonymous}::write_int_array(const int*, int)’:
stub.cpp:70:13: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’
   70 |         if (int ret = fwrite(arr, sizeof(int), len, fout); len != ret) {
      |             ^~~
stub.cpp: In function ‘void {anonymous}::read_int_array(int*, int)’:
stub.cpp:105:13: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’
  105 |         if (int ret = fread(arr, sizeof(int), len, fin); len != ret) {
      |             ^~~