답안 #388519

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
388519 2021-04-11T21:14:12 Z JimmyZJX Vision Program (IOI19_vision) C++14
14 / 100
13 ms 1684 KB
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cstring>
#include <climits>
#include <cassert>
#include <tuple>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <string>

using namespace std;

typedef long long LL;
typedef vector<int> Vi;
typedef vector<bool> Vb;
typedef vector<vector<int>> Vii;

#define forR(i, n) for (int i = 0; i < (n); i++)

int add_not(int N);
int add_and(Vi Ns);
int add_or(Vi Ns);
int add_xor(Vi Ns);

void construct_network(int H, int W, int K) {

	// d1[i] x+y == i    d2[i] x+(W-1-y) == i
	Vii d1(H + W - 1), d2(H + W - 1);

	forR(x, H) forR(y, W) {
		int index = x * W + y;

		int i1 = x + y, i2 = x + (W - 1 - y);
		d1[i1].push_back(index); d2[i2].push_back(index);
	}

	Vi d1r, d2r;

	for (auto& d1_line : d1) {
		d1r.push_back(add_xor(d1_line));
	}
	for (auto& d2_line : d2) {
		d2r.push_back(add_xor(d2_line));
	}

	int dd1_eq_1, dd2_eq_1;
	// d1
	{
		Vi rs;
		for (int i = 0; i < d1r.size() - 1; i++) {
			rs.push_back(add_and(Vi{ d1r[i], d1r[i + 1] }));
		}
		dd1_eq_1 = add_or(rs);
	}

	// d2
	{
		Vi rs;
		for (int i = 0; i < d2r.size() - 1; i++) {
			rs.push_back(add_and(Vi{ d2r[i], d2r[i + 1] }));
		}
		dd2_eq_1 = add_or(rs);
	}

	add_and(Vi{ dd1_eq_1,dd2_eq_1 });

	return;
}


#ifdef TEST_LOCAL
int add_not(int N) { return -1; }
int add_and(Vi Ns) { return -1; }
int add_or(Vi Ns) { return -1; }
int add_xor(Vi Ns) { return -1; }

int main() {
	construct_network(200, 200, 1);

	return 0;
}
#endif

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:54:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |   for (int i = 0; i < d1r.size() - 1; i++) {
      |                   ~~^~~~~~~~~~~~~~~~
vision.cpp:63:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   63 |   for (int i = 0; i < d2r.size() - 1; i++) {
      |                   ~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 208 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 208 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 208 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 208 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Incorrect 1 ms 332 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 1640 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 460 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 2 ms 332 KB Output is correct
7 Correct 8 ms 944 KB Output is correct
8 Correct 6 ms 972 KB Output is correct
9 Correct 11 ms 1684 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 208 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -