Submission #424813

# Submission time Handle Problem Language Result Execution time Memory
424813 2021-06-12T10:33:34 Z AugustinasJucas Vision Program (IOI19_vision) C++14
44 / 100
68 ms 4616 KB
#include <bits/stdc++.h>
#include "vision.h"
using namespace std;
vector<pair<int, int> > pss = {{-1, 1}, {-1, -1}, {1, 1}, {1, -1}};
vector<pair<int, int> > dists(int e, int s, int k, int n, int m){
	int pe = 0, ps = 0;
	vector<pair<int, int> > ret;
	vector<pair<int, int> > ans;
	for(auto x : pss){
		for(int i = 0; i <= k; i++){
			pe = e + x.first * i;
			ps = s + x.second * (k-i);
			if(pe < 0 || pe >= n || ps < 0 || ps >= m) continue;
			ret.push_back({pe, ps});
		}
	}
	if(ret.size() == 0) return {};
	sort(ret.begin(), ret.end());
	ans.push_back(ret[0]);
	for(int i = 1; i < (int) ret.size(); i++) if(ret[i] != ret[i-1]) ans.push_back(ret[i]);
	return ans;
}
void construct_network(int n, int m, int k) {
	int viso = 0; int prm = 0; 
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			//cout << i << ", "  << j << endl;
			auto ms = dists(i, j, k, n, m);
			if(ms.size() == 0) continue;
			vector<int> hsh; for(auto x : ms) hsh.push_back(x.first * m + x.second);
			add_or(hsh);
			//cout << "nuo [" << i << "; " << j << "] nutole per " << k << ": "; for(auto x : ms) cout << "{" << x.first << ", " << x.second << "}, "; 
			//cout << endl;
			viso++;
			prm++;
		} 
	}
	if(prm == 0){
		vector<int> ret;
		for(int i = 0; i < n*m; i++) ret.push_back(i);
		add_and(ret);
		return;
	}
	int curInd = n * m;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			auto ms = dists(i, j, k, n, m);
			if(ms.size() == 0) continue;
			
			vector<int> hsh = {curInd, i *  m + j};
			add_and(hsh);
			curInd++;
			viso++;
		}
	}

	vector<int> hsh;
	for(int i = n * m + prm; i < n*m+viso; i++){
		hsh.push_back(i);
	}
	add_or(hsh);
}



# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 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 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 292 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 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 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 292 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 260 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 292 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 292 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 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 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 292 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 260 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 292 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 292 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 8 ms 608 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 1 ms 204 KB Output is correct
32 Correct 2 ms 332 KB Output is correct
33 Correct 3 ms 332 KB Output is correct
34 Correct 8 ms 580 KB Output is correct
35 Correct 6 ms 460 KB Output is correct
36 Correct 2 ms 332 KB Output is correct
37 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 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 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 292 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 260 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 292 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 292 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 8 ms 608 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 1 ms 204 KB Output is correct
32 Correct 2 ms 332 KB Output is correct
33 Correct 3 ms 332 KB Output is correct
34 Correct 8 ms 580 KB Output is correct
35 Correct 6 ms 460 KB Output is correct
36 Correct 2 ms 332 KB Output is correct
37 Correct 1 ms 204 KB Output is correct
38 Incorrect 68 ms 4616 KB WA in grader: Too many inputs
39 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 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 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 288 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 324 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 288 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 288 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 292 KB Output is correct
3 Correct 7 ms 712 KB Output is correct
4 Correct 31 ms 1864 KB Output is correct
5 Correct 21 ms 1352 KB Output is correct
6 Correct 11 ms 676 KB Output is correct
7 Correct 5 ms 204 KB Output is correct
8 Incorrect 9 ms 964 KB WA in grader: Too many instructions
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 968 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 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 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 292 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 260 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 292 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 292 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 8 ms 608 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 1 ms 204 KB Output is correct
32 Correct 2 ms 332 KB Output is correct
33 Correct 3 ms 332 KB Output is correct
34 Correct 8 ms 580 KB Output is correct
35 Correct 6 ms 460 KB Output is correct
36 Correct 2 ms 332 KB Output is correct
37 Correct 1 ms 204 KB Output is correct
38 Incorrect 68 ms 4616 KB WA in grader: Too many inputs
39 Halted 0 ms 0 KB -