Submission #316711

# Submission time Handle Problem Language Result Execution time Memory
316711 2020-10-27T12:11:11 Z tengiz05 Vision Program (IOI19_vision) C++17
40 / 100
4 ms 800 KB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
int posl[405][405], posr[405][405];
int h, w;
int pos(int i, int j){
	return i*w+j;
}
void construct_network(int n, int m, int k) {
	h = n, w = m;
	if(max(h, w) <= 40){
	int timer = n*m;
	for(int p=0;p<n;p++){
		int i=p,j=0;
		posl[i][j] = add_or({pos(i,j)});
		i--,j++;
		timer++;
		while(i >= 0 && j < m){
			posl[i][j] = add_or({timer-1, pos(i, j)});timer++;
			i--, j++;
		}
	}for(int p=1;p<m;p++){
		int i=n-1,j=p;
		posl[i][j] = add_or({pos(i,j)});
		i--,j++;
		timer++;
		while(i >= 0 && j < m){
			posl[i][j] = add_or({timer-1, pos(i, j)});
			timer++;
			i--, j++;
		}
	}
	
	for(int p=0;p<n;p++){
		int i=p,j=0;
		posr[i][j] = add_or({pos(i,j)});
		i++,j++;
		timer++;
		while(i < n && j < m){
			posr[i][j] = add_or({timer-1, pos(i, j)});timer++;
			i++, j++;
		}
	}for(int p=1;p<m;p++){
		int i=0,j=p;
		posr[i][j] = add_or({pos(i,j)});
		i++,j++;
		timer++;
		while(i < n && j < m){
			posr[i][j] = add_or({timer-1, pos(i, j)});timer++;
			i++, j++;
		}
	}
	
	vector<int> v;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			int x1 = i+k, y1 = j;
			while(x1 > i && y1+1 < m)x1--, y1++;
			int x2 =x1, y2 = y1;
			while(x2+1 < n && y2 > j)x2++, y2--;
			if(x1 < n && y1 < m && x1 >= 0 && y1 >= 0){	
				if(x2+1 < n && y2-1 >= 0){
				//	cout << "I am bug";
					int t1 = add_not(posl[x2+1][y2-1]);
					int t = add_and({t1, posl[x1][y1], pos(i, j)});
					v.push_back(t);
				}else {
					int t = add_and({posl[x1][y1], pos(i, j)});
					v.push_back(t);
				}
			//	cout << x1 << ' ' << y1 << ";    " << x2 << ' ' << y2 << '\n';
			}x1 = i, y1 = j-k;
			while(x1+1 < n && y1 < j)x1++, y1++;
			x2 = x1, y2=y1;
			while(x2 > i && y2-1 >= 0)x2--, y2--;
			if(x1 < n && y1 < m && x1 >= 0 && y1 >= 0){
			//	cout << x1 << ' ' << y1 << ";   " << x2 << ' ' << y2 << '\n';
				if(x2-1 >= 0 && y2-1 >= 0){
					int t1 = add_not(posr[x2-1][y2-1]);
					int t = add_and({t1, posr[x1][y1], pos(i, j)});
					v.push_back(t);
				}else {
					int t = add_and({posr[x1][y1], pos(i, j)});
					v.push_back(t);
				}//cout << x1 << ' ' << y1 << ";    " << x2 << ' ' << y2 << "\n\n";
			}
		}
	}add_or(v);
	}else {
		int i=0,j=k;
		vector<int> v;
		while(j >= 0){
			if(i < n && j < m)v.push_back(add_or({pos(i, j)}));
			i++, j--;
		}add_or(v);
	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 0 ms 256 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 0 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 0 ms 256 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 0 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 0 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 0 ms 256 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 0 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 0 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 1 ms 384 KB Output is correct
28 Correct 3 ms 768 KB Output is correct
29 Correct 1 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 1 ms 512 KB Output is correct
32 Correct 2 ms 640 KB Output is correct
33 Correct 4 ms 800 KB Output is correct
34 Correct 4 ms 768 KB Output is correct
35 Correct 3 ms 640 KB Output is correct
36 Correct 2 ms 512 KB Output is correct
37 Correct 2 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 0 ms 256 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 0 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 0 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 1 ms 384 KB Output is correct
28 Correct 3 ms 768 KB Output is correct
29 Correct 1 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 1 ms 512 KB Output is correct
32 Correct 2 ms 640 KB Output is correct
33 Correct 4 ms 800 KB Output is correct
34 Correct 4 ms 768 KB Output is correct
35 Correct 3 ms 640 KB Output is correct
36 Correct 2 ms 512 KB Output is correct
37 Correct 2 ms 512 KB Output is correct
38 Incorrect 0 ms 256 KB on inputs (8, 61), (22, 97), expected 1, but computed 0
39 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB on inputs (0, 1), (0, 3), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 0 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 288 KB Output is correct
9 Correct 0 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 0 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 0 ms 256 KB Output is correct
18 Correct 0 ms 256 KB Output is correct
19 Correct 0 ms 256 KB Output is correct
20 Correct 0 ms 256 KB Output is correct
21 Correct 0 ms 256 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 0 ms 256 KB Output is correct
24 Correct 0 ms 256 KB Output is correct
25 Correct 0 ms 256 KB Output is correct
26 Correct 0 ms 256 KB Output is correct
27 Correct 0 ms 256 KB Output is correct
28 Correct 1 ms 256 KB Output is correct
29 Correct 1 ms 384 KB Output is correct
30 Correct 0 ms 256 KB Output is correct
31 Correct 1 ms 384 KB Output is correct
32 Correct 1 ms 256 KB Output is correct
33 Correct 0 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB on inputs (80, 199), (81, 199), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 0 ms 256 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 0 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 0 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 1 ms 384 KB Output is correct
28 Correct 3 ms 768 KB Output is correct
29 Correct 1 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 1 ms 512 KB Output is correct
32 Correct 2 ms 640 KB Output is correct
33 Correct 4 ms 800 KB Output is correct
34 Correct 4 ms 768 KB Output is correct
35 Correct 3 ms 640 KB Output is correct
36 Correct 2 ms 512 KB Output is correct
37 Correct 2 ms 512 KB Output is correct
38 Incorrect 0 ms 256 KB on inputs (8, 61), (22, 97), expected 1, but computed 0
39 Halted 0 ms 0 KB -