답안 #778420

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
778420 2023-07-10T10:04:33 Z Elias Vision Program (IOI19_vision) C++17
0 / 100
17 ms 2428 KB
#ifndef _DEBUG
#include "vision.h"
#endif

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

void construct_network(int H, int W, int K)
{
	int nott = add_not(0);
	int def_zero = add_and({0, nott});

	vector<int> xor_single;
	for (int i = 0; i < H; i++)
	{
		vector<int> indices;
		for (int j = 0; j < W; j++)
		{
			indices.push_back(i * W + j);
		}
		xor_single.push_back(add_xor(indices));
	}

	for (int j = 0; j < W; j++)
	{
		vector<int> indices;
		for (int i = 0; i < H; i++)
		{
			indices.push_back(i * W + j);
		}
		xor_single.push_back(add_xor(indices));
	}

	assert(xor_single.size() == W + H);

	vector<int> xor_prefix;
	vector<int> indices;
	for (int i = 0; i < W + H; i++)
	{
		indices.push_back(xor_single[i]);
		xor_prefix.push_back(add_xor(indices));
	}

	assert(xor_prefix.size() == W + H);

	vector<int> bits;
	for (int k = 0; k <= 8; k++)
	{
		int carry = def_zero;

		if (K & (1 << k))
			bits.push_back(add_xor(xor_prefix));
		else
			bits.push_back(add_not(add_xor(xor_prefix)));

		vector<int> new_xor_prefix;
		for (int i = 0; i < W + H; i++)
		{
			new_xor_prefix.push_back(add_and({carry, xor_prefix[i]}));
			carry = add_xor({carry, xor_prefix[i]});
		}
		xor_prefix = new_xor_prefix;
	}
	cout << "bits: ";
	for (int i = 0; i < bits.size(); i++)
		cout << bits[i] << " ";
	cout << "\n";

	add_and(bits);
}

Compilation message

In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from vision.cpp:5:
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:34:27: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   34 |  assert(xor_single.size() == W + H);
      |         ~~~~~~~~~~~~~~~~~~^~~~~~~~
vision.cpp:44:27: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   44 |  assert(xor_prefix.size() == W + H);
      |         ~~~~~~~~~~~~~~~~~~^~~~~~~~
vision.cpp:65:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |  for (int i = 0; i < bits.size(); i++)
      |                  ~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB secret mismatch
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB secret mismatch
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB secret mismatch
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB secret mismatch
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 724 KB secret mismatch
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB secret mismatch
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 17 ms 2428 KB secret mismatch
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB secret mismatch
2 Halted 0 ms 0 KB -