Submission #813406

# Submission time Handle Problem Language Result Execution time Memory
813406 2023-08-07T17:19:44 Z fatemetmhr Vision Program (IOI19_vision) C++17
20 / 100
25 ms 5352 KB
// Comment!


#include "vision.h"
#include <bits/stdc++.h>

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


typedef long long ll;

#define mp     make_pair
#define all(x) x.begin(), x.end()
#define pb     push_back
#define fi     first
#define se     second

const int maxn5 = 2e5 + 10;

vector <int> ns, av[2], av2[2];
int h, w, dim[2][maxn5], xdim[2][maxn5];


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

	h = H;
	w = W;
	memset(dim, -1, sizeof dim);
	for(int sum = 0; sum <= h + w - 2; sum++){
		ns.clear();
		for(int i = 0; i < h; i++){
			int j = sum - i;
			if(j >= 0 && j < w)
				ns.pb(i * w + j);
		}
		sort(all(ns));
		dim[0][sum] = add_or(ns);
		xdim[0][sum] = add_xor(ns);
	}
	for(int sum = -(h - 1); sum < w; sum++){
		ns.clear();
		for(int i = 0; i < h; i++){
			int j = sum + i;
			if(j >= 0 && j < w)
				ns.pb(i * w + j);
		}
		sort(all(ns));
		dim[1][sum + h - 1] = add_or(ns);
		xdim[1][sum + h - 1] = add_xor(ns);
	}
	int eqk, eq[2], lestk, les[2];
	for(int sum = 0; sum <= h + w - 2; sum++){
		for(int tt = 0; tt < 2; tt++){
			if(sum + k <= h + w - 2){
				ns = {dim[tt][sum], dim[tt][sum + k]};
				av[tt].pb(add_and(ns));	
			}
			ns.clear();
			for(int x = 1; x <= k; x++) if(x + sum <= h + w - 2)
				ns.pb(dim[tt][x + sum]);
			int cur = -1;
			if(ns.size()){
				cur = add_or(ns);
				ns = {dim[tt][sum], cur};
				cur = add_and(ns);
			}
			int cur2 = add_not(xdim[tt][sum]);
			if(cur == -1)
				av2[tt].pb(cur2);
			else{
				ns = {cur2, dim[tt][sum]};
				cur2 = add_and(ns);
				ns = {cur, cur2};
				av2[tt].pb(add_or(ns));
			}
		}
	}
	for(int tt = 0; tt < 2; tt++){
		sort(all(av[tt]));
		eq[tt] = add_or(av[tt]);
		sort(all(av2[tt]));
		les[tt] = add_or(av2[tt]);
	}
	ns = {eq[0], eq[1]};
	eqk = add_or(ns);
	ns = {les[0], les[1]};
	lestk = add_and(ns);
	ns = {eqk, lestk};
	//cout << eq[0] + 1 << ' ' << eq[1] + 1 << ' ' << eqk + 1 << endl;
	//cout << les[0] + 1 << ' ' << les[1] + 1 << ' ' << lestk + 1 << endl;
	add_and(ns);
}














# Verdict Execution time Memory Grader output
1 Correct 1 ms 1876 KB Output is correct
2 Correct 1 ms 1876 KB Output is correct
3 Correct 1 ms 1876 KB Output is correct
4 Correct 1 ms 1876 KB Output is correct
5 Correct 1 ms 1876 KB Output is correct
6 Correct 1 ms 1876 KB Output is correct
7 Correct 1 ms 1876 KB Output is correct
8 Correct 1 ms 1876 KB Output is correct
9 Correct 1 ms 1848 KB Output is correct
10 Correct 1 ms 1876 KB Output is correct
11 Correct 1 ms 1876 KB Output is correct
12 Correct 1 ms 1876 KB Output is correct
13 Incorrect 1 ms 1876 KB on inputs (0, 0), (1, 2), expected 0, but computed 1
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1876 KB Output is correct
2 Correct 1 ms 1876 KB Output is correct
3 Correct 1 ms 1876 KB Output is correct
4 Correct 1 ms 1876 KB Output is correct
5 Correct 1 ms 1876 KB Output is correct
6 Correct 1 ms 1876 KB Output is correct
7 Correct 1 ms 1876 KB Output is correct
8 Correct 1 ms 1876 KB Output is correct
9 Correct 1 ms 1848 KB Output is correct
10 Correct 1 ms 1876 KB Output is correct
11 Correct 1 ms 1876 KB Output is correct
12 Correct 1 ms 1876 KB Output is correct
13 Incorrect 1 ms 1876 KB on inputs (0, 0), (1, 2), expected 0, but computed 1
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1876 KB Output is correct
2 Correct 1 ms 1876 KB Output is correct
3 Correct 1 ms 1876 KB Output is correct
4 Correct 1 ms 1876 KB Output is correct
5 Correct 1 ms 1876 KB Output is correct
6 Correct 1 ms 1876 KB Output is correct
7 Correct 1 ms 1876 KB Output is correct
8 Correct 1 ms 1876 KB Output is correct
9 Correct 1 ms 1848 KB Output is correct
10 Correct 1 ms 1876 KB Output is correct
11 Correct 1 ms 1876 KB Output is correct
12 Correct 1 ms 1876 KB Output is correct
13 Incorrect 1 ms 1876 KB on inputs (0, 0), (1, 2), expected 0, but computed 1
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1876 KB Output is correct
2 Correct 1 ms 1876 KB Output is correct
3 Correct 1 ms 1876 KB Output is correct
4 Correct 1 ms 1876 KB Output is correct
5 Correct 1 ms 1876 KB Output is correct
6 Correct 1 ms 1876 KB Output is correct
7 Correct 1 ms 1876 KB Output is correct
8 Correct 1 ms 1876 KB Output is correct
9 Correct 1 ms 1848 KB Output is correct
10 Correct 1 ms 1876 KB Output is correct
11 Correct 1 ms 1876 KB Output is correct
12 Correct 1 ms 1876 KB Output is correct
13 Incorrect 1 ms 1876 KB on inputs (0, 0), (1, 2), expected 0, but computed 1
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2132 KB Output is correct
2 Correct 4 ms 2260 KB Output is correct
3 Correct 4 ms 2260 KB Output is correct
4 Correct 4 ms 2388 KB Output is correct
5 Correct 2 ms 2132 KB Output is correct
6 Correct 3 ms 2236 KB Output is correct
7 Correct 4 ms 2388 KB Output is correct
8 Correct 4 ms 2364 KB Output is correct
9 Correct 3 ms 2108 KB Output is correct
10 Correct 3 ms 2232 KB Output is correct
11 Correct 4 ms 2304 KB Output is correct
12 Correct 4 ms 2236 KB Output is correct
13 Correct 4 ms 2388 KB Output is correct
14 Correct 5 ms 2368 KB Output is correct
15 Correct 2 ms 2132 KB Output is correct
16 Correct 3 ms 2260 KB Output is correct
17 Correct 4 ms 2260 KB Output is correct
18 Correct 4 ms 2260 KB Output is correct
19 Correct 4 ms 2388 KB Output is correct
20 Correct 5 ms 2364 KB Output is correct
21 Correct 1 ms 1848 KB Output is correct
22 Correct 1 ms 1852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1876 KB Output is correct
2 Correct 1 ms 1876 KB Output is correct
3 Correct 2 ms 2132 KB Output is correct
4 Correct 3 ms 2132 KB Output is correct
5 Correct 3 ms 2132 KB Output is correct
6 Correct 3 ms 2132 KB Output is correct
7 Correct 3 ms 2260 KB Output is correct
8 Correct 3 ms 2260 KB Output is correct
9 Correct 4 ms 2364 KB Output is correct
10 Correct 5 ms 2488 KB Output is correct
11 Correct 6 ms 2480 KB Output is correct
12 Correct 6 ms 2592 KB Output is correct
13 Correct 2 ms 2132 KB Output is correct
14 Correct 4 ms 2236 KB Output is correct
15 Correct 4 ms 2388 KB Output is correct
16 Correct 4 ms 2388 KB Output is correct
17 Correct 2 ms 2132 KB Output is correct
18 Correct 4 ms 2240 KB Output is correct
19 Correct 4 ms 2388 KB Output is correct
20 Correct 8 ms 2896 KB Output is correct
21 Correct 12 ms 3412 KB Output is correct
22 Correct 13 ms 3648 KB Output is correct
23 Correct 14 ms 3736 KB Output is correct
24 Correct 8 ms 2896 KB Output is correct
25 Correct 13 ms 3536 KB Output is correct
26 Correct 14 ms 3864 KB Output is correct
27 Correct 14 ms 3920 KB Output is correct
28 Correct 19 ms 4532 KB Output is correct
29 Correct 22 ms 5072 KB Output is correct
30 Correct 24 ms 5352 KB Output is correct
31 Correct 25 ms 5328 KB Output is correct
32 Correct 1 ms 1852 KB Output is correct
33 Correct 1 ms 1876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 3896 KB on inputs (126, 120), (176, 169), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1876 KB Output is correct
2 Correct 1 ms 1876 KB Output is correct
3 Correct 1 ms 1876 KB Output is correct
4 Correct 1 ms 1876 KB Output is correct
5 Correct 1 ms 1876 KB Output is correct
6 Correct 1 ms 1876 KB Output is correct
7 Correct 1 ms 1876 KB Output is correct
8 Correct 1 ms 1876 KB Output is correct
9 Correct 1 ms 1848 KB Output is correct
10 Correct 1 ms 1876 KB Output is correct
11 Correct 1 ms 1876 KB Output is correct
12 Correct 1 ms 1876 KB Output is correct
13 Incorrect 1 ms 1876 KB on inputs (0, 0), (1, 2), expected 0, but computed 1
14 Halted 0 ms 0 KB -