답안 #430458

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
430458 2021-06-16T14:02:47 Z p_square Vision Program (IOI19_vision) C++14
12 / 100
253 ms 1348 KB
#include <vision.h>
#include <bits/stdc++.h>

using namespace std;

#define mp make_pair
#define fi first
#define se second

int h;
int w;
int k;

int cnum(int i, int j)
{
	return i*w + j;
}

void opt(vector <int> qry)
{
	for(int i = 0; i<qry.size(); i++)
	{
		cerr<<qry[i]<<" ";
	}
}

void construct_network(int H, int W, int K)
{
	h = H;
	w = W;
	k = K;

	int row, col, reply, NWd = h*w, NEd = h*w+h+w-1, cr1be, cr1en, cr1;
	vector <int> qry;
	for(int diag = 0; diag<h+w-1; diag++)
	{
		qry.clear();
		for(row = 0; row<h; row++)
		{
			col = diag - row;
			if(col >= 0 && col < w)
			{
				qry.push_back(cnum(row, col));
			}
		}
		assert(!qry.empty());
		reply = add_xor(qry);
	}
	for(int diag = 0; diag<h+w-1; diag++)
	{
		qry.clear();
		for(row = 0; row<h; row++)
		{
			col = w + row - diag - 1;
			if(col >= 0 && col < w)
			{
				cerr<<row<<" "<<col<<endl;
				qry.push_back(cnum(row, col));
			}
		}
		assert(!qry.empty());
		reply = add_xor(qry);
	}

	cr1be = reply+1;

	for(int i = 0; i<h+w-k-1; i++)
	{
		reply = add_and({NWd+i, NWd+i+k});
	}
	for(int i = 0; i<h+w-k-1; i++)
	{
		reply = add_and({NEd+i, NEd+i+k});
	}

	cr1en = reply;
	qry.clear();
	for(int i = cr1be; i<=cr1en; i++)
	{
		qry.push_back(i);
	}
	assert(!qry.empty());
	cr1 = add_or(qry);

}

Compilation message

vision.cpp: In function 'void opt(std::vector<int>)':
vision.cpp:21:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |  for(int i = 0; i<qry.size(); i++)
      |                 ~^~~~~~~~~~~
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:33:65: warning: variable 'cr1' set but not used [-Wunused-but-set-variable]
   33 |  int row, col, reply, NWd = h*w, NEd = h*w+h+w-1, cr1be, cr1en, cr1;
      |                                                                 ^~~
vision.cpp:65:8: warning: 'reply' may be used uninitialized in this function [-Wmaybe-uninitialized]
   65 |  cr1be = reply+1;
      |  ~~~~~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 260 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Incorrect 1 ms 204 KB on inputs (0, 2), (1, 0), expected 0, but computed 1
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 260 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Incorrect 1 ms 204 KB on inputs (0, 2), (1, 0), expected 0, but computed 1
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 260 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Incorrect 1 ms 204 KB on inputs (0, 2), (1, 0), expected 0, but computed 1
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 260 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Incorrect 1 ms 204 KB on inputs (0, 2), (1, 0), expected 0, but computed 1
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 2 ms 332 KB Output is correct
6 Correct 2 ms 332 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 2 ms 332 KB Output is correct
10 Correct 2 ms 332 KB Output is correct
11 Correct 2 ms 332 KB Output is correct
12 Correct 2 ms 332 KB Output is correct
13 Correct 2 ms 204 KB Output is correct
14 Correct 2 ms 332 KB Output is correct
15 Correct 2 ms 332 KB Output is correct
16 Correct 2 ms 332 KB Output is correct
17 Correct 2 ms 332 KB Output is correct
18 Correct 2 ms 332 KB Output is correct
19 Correct 2 ms 332 KB Output is correct
20 Correct 2 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 20 ms 332 KB Output is correct
4 Correct 19 ms 312 KB Output is correct
5 Correct 19 ms 332 KB Output is correct
6 Correct 19 ms 332 KB Output is correct
7 Correct 21 ms 332 KB Output is correct
8 Correct 39 ms 412 KB Output is correct
9 Correct 41 ms 356 KB Output is correct
10 Correct 39 ms 460 KB Output is correct
11 Correct 39 ms 332 KB Output is correct
12 Correct 38 ms 332 KB Output is correct
13 Correct 2 ms 292 KB Output is correct
14 Correct 2 ms 332 KB Output is correct
15 Correct 2 ms 332 KB Output is correct
16 Correct 2 ms 296 KB Output is correct
17 Correct 2 ms 332 KB Output is correct
18 Correct 2 ms 332 KB Output is correct
19 Correct 2 ms 332 KB Output is correct
20 Correct 129 ms 800 KB Output is correct
21 Incorrect 130 ms 792 KB on inputs (0, 0), (199, 99), expected 0, but computed 1
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 253 ms 1348 KB on inputs (126, 120), (176, 169), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 260 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Incorrect 1 ms 204 KB on inputs (0, 2), (1, 0), expected 0, but computed 1
8 Halted 0 ms 0 KB -