제출 #445806

#제출 시각아이디문제언어결과실행 시간메모리
445806rainboyVision Program (IOI19_vision)C++14
100 / 100
75 ms4672 KiB
#include "vision.h"

using namespace std;

typedef vector<int> vi;

const int N = 200, M = 200;

int close(int *aa, int n, int k) {
	vi uu;
	int i, j, yes;

	uu.resize(2);
	yes = -1;
	for (i = 0; i < n; i++)
		if (yes == -1)
			yes = aa[i];
		else
			uu[0] = yes, uu[1] = aa[i], yes = add_xor(uu);
	if (k > 0)
		for (i = 0; i + 1 < n; i++) {
			int yes_;

			uu.resize(0);
			for (j = i + 1; j <= i + k && j < n; j++)
				uu.push_back(aa[j]);
			yes_ = add_or(uu);
			uu.resize(2);
			uu[0] = yes_, uu[1] = aa[i], yes_ = add_and(uu);
			uu[0] = yes, uu[1] = yes_, yes = add_or(uu);
		}
	return yes;
}

int aa[N + M], bb[N + M];

void construct_network(int n, int m, int k) {
	int x, y, i, j, not_too_far, not_too_close, yes;
	vi uu;

	for (x = 0; x <= (n - 1) + (m - 1); x++) {
		uu.resize(0);
		for (i = 0; i < n; i++)
			for (j = 0; j < m; j++)
				if (i + j == x)
					uu.push_back(i * m + j);
		aa[x] = add_or(uu);
	}
	for (y = 0; y <= (n - 1) + (m - 1); y++) {
		uu.resize(0);
		for (i = 0; i < n; i++)
			for (j = 0; j < m; j++)
				if (i - j + m - 1 == y)
					uu.push_back(i * m + j);
		bb[y] = add_or(uu);
	}
	uu.resize(2);
	uu[0] = close(aa, n + m - 1, k), uu[1] = close(bb, n + m - 1, k), not_too_far = add_and(uu);
	uu[0] = close(aa, n + m - 1, k - 1), uu[1] = close(bb, n + m - 1, k - 1), not_too_close = add_not(add_and(uu));
	uu[0] = not_too_far, uu[1] = not_too_close;
	yes = add_and(uu);
}

컴파일 시 표준 에러 (stderr) 메시지

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:38:46: warning: variable 'yes' set but not used [-Wunused-but-set-variable]
   38 |  int x, y, i, j, not_too_far, not_too_close, yes;
      |                                              ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...