답안 #418544

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
418544 2021-06-05T13:28:11 Z Tangent Vision Program (IOI19_vision) C++17
26 / 100
17 ms 2080 KB
#include "vision.h"
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vii> vvii;
typedef vector<vll> vvll;
typedef vector<vpii> vvpii;
typedef vector<vpll> vvpll;


#define ffor(i, a, b) for (ll i = a; i < b; i++)
#define rep(i, n) ffor(i, 0, n)
#define forin(x, a) for (auto &x: a)
#define all(a) a.begin(), a.end()

void construct_network(int H, int W, int K) {
	map<int, vii> diaga, diagb;
	rep(i, H) {
		rep(j, W) {
			int k = W * i + j;
			diaga[i + j].emplace_back(k);
			diagb[i - j].emplace_back(k);
		}
	}
	vii inda, indb, res;
	forin(diag, diaga) {
		inda.emplace_back(add_or(diag.second));
	}
	forin(diag, diagb) {
		indb.emplace_back(add_or(diag.second));
	}
	vii deltaa, deltab;
	vii dkaa, dkbb, ckaa, ckbb;
	rep(i, inda.size() - K) {
		dkaa.emplace_back(add_and({inda[i], inda[i + K]}));
		vii curr;
		ffor(j, i, i + K + 1) {
			curr.emplace_back(inda[j]);
		}
		ckaa.emplace_back(add_and({add_or(curr), add_not(add_xor(curr))}));
	}
	rep(i, indb.size() - K) {
		dkbb.emplace_back(add_and({indb[i], indb[i + K]}));
		vii curr;
		ffor(j, i, i + K + 1) {
			curr.emplace_back(indb[j]);
		}
		ckbb.emplace_back(add_and({add_or(curr), add_not(add_xor(curr))}));
	}
	int dka = add_or(dkaa), dkb = add_or(dkbb), cka = add_or(ckaa), ckb = add_or(ckbb);
	
	add_and({add_or({dka, dkb}), cka, ckb});
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:19:40: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 | #define ffor(i, a, b) for (ll i = a; i < b; i++)
      |                                        ^
vision.cpp:20:19: note: in expansion of macro 'ffor'
   20 | #define rep(i, n) ffor(i, 0, n)
      |                   ^~~~
vision.cpp:42:2: note: in expansion of macro 'rep'
   42 |  rep(i, inda.size() - K) {
      |  ^~~
vision.cpp:19:40: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 | #define ffor(i, a, b) for (ll i = a; i < b; i++)
      |                                        ^
vision.cpp:20:19: note: in expansion of macro 'ffor'
   20 | #define rep(i, n) ffor(i, 0, n)
      |                   ^~~~
vision.cpp:50:2: note: in expansion of macro 'rep'
   50 |  rep(i, indb.size() - K) {
      |  ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Incorrect 1 ms 204 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Incorrect 1 ms 204 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Incorrect 1 ms 204 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Incorrect 1 ms 204 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 460 KB Output is correct
2 Correct 5 ms 716 KB Output is correct
3 Correct 5 ms 716 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 2 ms 588 KB Output is correct
6 Correct 5 ms 716 KB Output is correct
7 Correct 5 ms 588 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 2 ms 460 KB Output is correct
10 Correct 5 ms 716 KB Output is correct
11 Correct 6 ms 716 KB Output is correct
12 Correct 6 ms 716 KB Output is correct
13 Correct 4 ms 588 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 2 ms 460 KB Output is correct
16 Correct 5 ms 716 KB Output is correct
17 Correct 6 ms 720 KB Output is correct
18 Correct 8 ms 716 KB Output is correct
19 Correct 4 ms 588 KB Output is correct
20 Correct 1 ms 332 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 Incorrect 1 ms 204 KB on inputs (0, 0), (1, 1), expected 1, but computed 0
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 2080 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 2 ms 460 KB Output is correct
4 Correct 4 ms 716 KB Output is correct
5 Correct 3 ms 460 KB Output is correct
6 Correct 2 ms 460 KB Output is correct
7 Correct 10 ms 1240 KB Output is correct
8 Correct 10 ms 1228 KB Output is correct
9 Correct 17 ms 2072 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 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Incorrect 1 ms 204 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -