Submission #267212

# Submission time Handle Problem Language Result Execution time Memory
267212 2020-08-16T01:26:00 Z ggooroo Vision Program (IOI19_vision) C++14
33 / 100
18 ms 3452 KB
#include "vision.h"
#include <cstdio>
#include <iostream>
#include <queue>
#include <set>
#include <map>
#define N 205
using namespace std;

int h, w, k, T, en, mn = 2e9, mx, v[N][N];
int dr[4] = {-1, 0, 0, 1}, dc[4] = {0, -1, 1, 0};
set<int> vi[40005];
queue<int> qr, qc, qe;
int pq_num(int p, int q) {
	return p * w + q;
}

void pu(int p, int q, int e) {
	if (p < 0 || p >= h || q < 0 || q >= w || v[p][q] == T) return;
	v[p][q] = T;
	qr.push(p);
	qc.push(q);
	qe.push(e);
}

vector<int> in;
void f(int p, int q, int k) {
	int i, tr, tc, te, re, x1, x2;
	pu(p, q, 0);
	while (!qr.empty()) {
		tr = qr.front(); qr.pop();
		tc = qc.front(); qc.pop();
		te = qe.front(); qe.pop();
		if (te == k) {
			in.clear();
			x1 = pq_num(p, q);
			x2 = pq_num(tr, tc);
			if (x1 > x2) swap(x1, x2);
			if (vi[x1].count(x2) == 1) continue;
			vi[x1].insert(x2);
			in.push_back(x1);
			in.push_back(x2);
			re = add_and(in);
			mn = min(mn, re);
			mx = max(mx, re);
		} else {
			for (i = 0; i < 4; i++) {
				pu(tr + dr[i], tc + dc[i], te + 1);
			}
		}
	}
}

void construct_network(int hh, int ww, int kk) {
	int i, j;
	h = hh;
	w = ww;
	k = kk;
	for (i = 0; i < h; i++) {
		for (j = 0; j < w; j++) {
			T++;
			f(i, j, k);
		}
	}
	in.clear();
	for (i = mn; i <= mx; i++) {
		in.push_back(i);
	}
	add_or(in);
//	Ns = {0, 1};
//	int a = add_and(Ns);
//	Ns = {0, a};
//	int b = add_or(Ns);
//	Ns = {0, 1, b};
//	int c = add_xor(Ns);
//	add_not(c);

}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2176 KB Output is correct
2 Correct 1 ms 2176 KB Output is correct
3 Correct 1 ms 2176 KB Output is correct
4 Correct 2 ms 2176 KB Output is correct
5 Correct 2 ms 2176 KB Output is correct
6 Correct 2 ms 2176 KB Output is correct
7 Correct 2 ms 2176 KB Output is correct
8 Correct 2 ms 2176 KB Output is correct
9 Correct 2 ms 2176 KB Output is correct
10 Correct 2 ms 2176 KB Output is correct
11 Correct 2 ms 2176 KB Output is correct
12 Correct 1 ms 2176 KB Output is correct
13 Correct 2 ms 2176 KB Output is correct
14 Correct 2 ms 2176 KB Output is correct
15 Correct 1 ms 2176 KB Output is correct
16 Correct 2 ms 2176 KB Output is correct
17 Correct 1 ms 2176 KB Output is correct
18 Correct 2 ms 2176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2176 KB Output is correct
2 Correct 1 ms 2176 KB Output is correct
3 Correct 1 ms 2176 KB Output is correct
4 Correct 2 ms 2176 KB Output is correct
5 Correct 2 ms 2176 KB Output is correct
6 Correct 2 ms 2176 KB Output is correct
7 Correct 2 ms 2176 KB Output is correct
8 Correct 2 ms 2176 KB Output is correct
9 Correct 2 ms 2176 KB Output is correct
10 Correct 2 ms 2176 KB Output is correct
11 Correct 2 ms 2176 KB Output is correct
12 Correct 1 ms 2176 KB Output is correct
13 Correct 2 ms 2176 KB Output is correct
14 Correct 2 ms 2176 KB Output is correct
15 Correct 1 ms 2176 KB Output is correct
16 Correct 2 ms 2176 KB Output is correct
17 Correct 1 ms 2176 KB Output is correct
18 Correct 2 ms 2176 KB Output is correct
19 Correct 1 ms 2176 KB Output is correct
20 Correct 2 ms 2176 KB Output is correct
21 Correct 2 ms 2176 KB Output is correct
22 Correct 2 ms 2176 KB Output is correct
23 Correct 2 ms 2176 KB Output is correct
24 Correct 2 ms 2304 KB Output is correct
25 Correct 2 ms 2304 KB Output is correct
26 Correct 2 ms 2176 KB Output is correct
27 Correct 2 ms 2176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2176 KB Output is correct
2 Correct 1 ms 2176 KB Output is correct
3 Correct 1 ms 2176 KB Output is correct
4 Correct 2 ms 2176 KB Output is correct
5 Correct 2 ms 2176 KB Output is correct
6 Correct 2 ms 2176 KB Output is correct
7 Correct 2 ms 2176 KB Output is correct
8 Correct 2 ms 2176 KB Output is correct
9 Correct 2 ms 2176 KB Output is correct
10 Correct 2 ms 2176 KB Output is correct
11 Correct 2 ms 2176 KB Output is correct
12 Correct 1 ms 2176 KB Output is correct
13 Correct 2 ms 2176 KB Output is correct
14 Correct 2 ms 2176 KB Output is correct
15 Correct 1 ms 2176 KB Output is correct
16 Correct 2 ms 2176 KB Output is correct
17 Correct 1 ms 2176 KB Output is correct
18 Correct 2 ms 2176 KB Output is correct
19 Correct 1 ms 2176 KB Output is correct
20 Correct 2 ms 2176 KB Output is correct
21 Correct 2 ms 2176 KB Output is correct
22 Correct 2 ms 2176 KB Output is correct
23 Correct 2 ms 2176 KB Output is correct
24 Correct 2 ms 2304 KB Output is correct
25 Correct 2 ms 2304 KB Output is correct
26 Correct 2 ms 2176 KB Output is correct
27 Correct 2 ms 2176 KB Output is correct
28 Incorrect 9 ms 3452 KB WA in grader: Too many instructions
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2176 KB Output is correct
2 Correct 1 ms 2176 KB Output is correct
3 Correct 1 ms 2176 KB Output is correct
4 Correct 2 ms 2176 KB Output is correct
5 Correct 2 ms 2176 KB Output is correct
6 Correct 2 ms 2176 KB Output is correct
7 Correct 2 ms 2176 KB Output is correct
8 Correct 2 ms 2176 KB Output is correct
9 Correct 2 ms 2176 KB Output is correct
10 Correct 2 ms 2176 KB Output is correct
11 Correct 2 ms 2176 KB Output is correct
12 Correct 1 ms 2176 KB Output is correct
13 Correct 2 ms 2176 KB Output is correct
14 Correct 2 ms 2176 KB Output is correct
15 Correct 1 ms 2176 KB Output is correct
16 Correct 2 ms 2176 KB Output is correct
17 Correct 1 ms 2176 KB Output is correct
18 Correct 2 ms 2176 KB Output is correct
19 Correct 1 ms 2176 KB Output is correct
20 Correct 2 ms 2176 KB Output is correct
21 Correct 2 ms 2176 KB Output is correct
22 Correct 2 ms 2176 KB Output is correct
23 Correct 2 ms 2176 KB Output is correct
24 Correct 2 ms 2304 KB Output is correct
25 Correct 2 ms 2304 KB Output is correct
26 Correct 2 ms 2176 KB Output is correct
27 Correct 2 ms 2176 KB Output is correct
28 Incorrect 9 ms 3452 KB WA in grader: Too many instructions
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2176 KB Output is correct
2 Correct 2 ms 2176 KB Output is correct
3 Correct 4 ms 2176 KB Output is correct
4 Correct 3 ms 2176 KB Output is correct
5 Correct 2 ms 2432 KB Output is correct
6 Correct 2 ms 2432 KB Output is correct
7 Correct 3 ms 2304 KB Output is correct
8 Correct 3 ms 2304 KB Output is correct
9 Correct 2 ms 2176 KB Output is correct
10 Correct 2 ms 2176 KB Output is correct
11 Correct 2 ms 2176 KB Output is correct
12 Correct 3 ms 2176 KB Output is correct
13 Correct 2 ms 2176 KB Output is correct
14 Correct 2 ms 2176 KB Output is correct
15 Correct 2 ms 2432 KB Output is correct
16 Correct 2 ms 2336 KB Output is correct
17 Correct 3 ms 2432 KB Output is correct
18 Correct 3 ms 2432 KB Output is correct
19 Correct 3 ms 2304 KB Output is correct
20 Correct 3 ms 2304 KB Output is correct
21 Correct 2 ms 2176 KB Output is correct
22 Correct 2 ms 2176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2208 KB Output is correct
2 Correct 2 ms 2176 KB Output is correct
3 Correct 7 ms 3068 KB Output is correct
4 Incorrect 18 ms 3452 KB WA in grader: Too many instructions
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 3324 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2176 KB Output is correct
2 Correct 1 ms 2176 KB Output is correct
3 Correct 1 ms 2176 KB Output is correct
4 Correct 2 ms 2176 KB Output is correct
5 Correct 2 ms 2176 KB Output is correct
6 Correct 2 ms 2176 KB Output is correct
7 Correct 2 ms 2176 KB Output is correct
8 Correct 2 ms 2176 KB Output is correct
9 Correct 2 ms 2176 KB Output is correct
10 Correct 2 ms 2176 KB Output is correct
11 Correct 2 ms 2176 KB Output is correct
12 Correct 1 ms 2176 KB Output is correct
13 Correct 2 ms 2176 KB Output is correct
14 Correct 2 ms 2176 KB Output is correct
15 Correct 1 ms 2176 KB Output is correct
16 Correct 2 ms 2176 KB Output is correct
17 Correct 1 ms 2176 KB Output is correct
18 Correct 2 ms 2176 KB Output is correct
19 Correct 1 ms 2176 KB Output is correct
20 Correct 2 ms 2176 KB Output is correct
21 Correct 2 ms 2176 KB Output is correct
22 Correct 2 ms 2176 KB Output is correct
23 Correct 2 ms 2176 KB Output is correct
24 Correct 2 ms 2304 KB Output is correct
25 Correct 2 ms 2304 KB Output is correct
26 Correct 2 ms 2176 KB Output is correct
27 Correct 2 ms 2176 KB Output is correct
28 Incorrect 9 ms 3452 KB WA in grader: Too many instructions
29 Halted 0 ms 0 KB -