Submission #1050532

# Submission time Handle Problem Language Result Execution time Memory
1050532 2024-08-09T10:33:18 Z Kel_Mahmut Vision Program (IOI19_vision) C++14
8 / 100
45 ms 9068 KB
#include "vision.h"
#include <bits/stdc++.h>
#define pb push_back
#define endl ("\n")
#define all(aa) aa.begin(), aa.end()
typedef long long ll;
using namespace std;


void construct_network(int h, int w, int k) {
	function<int(int, int)> f = [&](int a, int b){
		return a * w + b;
	};
	int maxdigit = 10;
	vector<int> xdigit(maxdigit);

	for(int dig = 1; dig <= maxdigit; dig++){
		int num = 1 << dig;
		int lst = num / 2;
		vector<vector<int>> query(num);
		for(int i = 0; i < h; i++){
			for(int j = 0; j < w; j++){
				query[(j % num)/lst].pb(f(i, j));
			}
		}

		vector<int> res;
		for(int i = 0; i < num; i++){
			if(query[i].size()){
				res.pb(add_xor(query[i]));
			}
		}
		xdigit[dig - 1] = add_or(res);
	}

	vector<int> ydigit(maxdigit);
	for(int dig = 1; dig <= maxdigit; dig++){
		int num = 1 << dig;
		int lst = num / 2;
		vector<vector<int>> query(num);
		for(int i = 0; i < h; i++){
			for(int j = 0; j < w; j++){
				query[(i % num) / lst].pb(f(i, j));
			}
		}

		vector<int> res;
		for(int i = 0; i < num; i++){
			if(query[i].size())
				res.pb(add_xor(query[i]));
		}
		ydigit[dig - 1] = add_or(res);
	}

	vector<int> notxdigit(maxdigit);
	vector<int> notydigit(maxdigit);
	for(int i = 0; i < maxdigit; i++){
		notxdigit[i] = add_not(xdigit[i]);
	}

	for(int i = 0; i < maxdigit; i++){
		notydigit[i] = add_not(ydigit[i]);
	}

	function<int(int)> xask = [&](int a){
		vector<int> query(maxdigit);
		for(int dig = 0; dig < maxdigit; dig++){
			if((a >> dig) & 1){
				query[dig] = xdigit[dig];
			}
			else
				query[dig] = notxdigit[dig];
		}
		int ret = add_and(query);
		return ret;
	};

	function<int(int)> yask = [&](int a){
		vector<int> query(maxdigit);
		for(int dig = 0; dig < maxdigit; dig++){
			if((a >> dig) & 1){
				query[dig] = ydigit[dig];
			}
			else
				query[dig] = notydigit[dig];
		}
		int ret = add_and(query);
		return ret;
	};


	vector<int> ans;
	for(int x = 0; x <= k; x++){
		int y = k - x;
		vector<int> cur;
		cur.pb(xask(x));
		cur.pb(yask(y));
		ans.pb(add_and(cur));
	}
	int lesgoo = add_or(ans);
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:100:6: warning: unused variable 'lesgoo' [-Wunused-variable]
  100 |  int lesgoo = add_or(ans);
      |      ^~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB on inputs (0, 1), (0, 2), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB on inputs (0, 1), (0, 2), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB on inputs (0, 1), (0, 2), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB on inputs (0, 1), (0, 2), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB on inputs (0, 1), (0, 2), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 3 ms 948 KB Output is correct
4 Correct 3 ms 860 KB Output is correct
5 Correct 3 ms 860 KB Output is correct
6 Correct 3 ms 952 KB Output is correct
7 Correct 3 ms 1032 KB Output is correct
8 Correct 6 ms 1628 KB Output is correct
9 Correct 6 ms 1628 KB Output is correct
10 Correct 6 ms 1400 KB Output is correct
11 Correct 6 ms 1628 KB Output is correct
12 Correct 6 ms 1444 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 19 ms 4588 KB Output is correct
21 Correct 20 ms 4620 KB Output is correct
22 Correct 20 ms 4492 KB Output is correct
23 Correct 20 ms 4604 KB Output is correct
24 Correct 20 ms 4596 KB Output is correct
25 Correct 20 ms 4600 KB Output is correct
26 Correct 20 ms 4620 KB Output is correct
27 Correct 39 ms 8788 KB Output is correct
28 Correct 45 ms 9048 KB Output is correct
29 Correct 41 ms 9048 KB Output is correct
30 Correct 39 ms 9048 KB Output is correct
31 Correct 42 ms 9068 KB Output is correct
32 Correct 0 ms 344 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 39 ms 8808 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 3 ms 860 KB on inputs (69, 17), (69, 18), expected 1, but computed 0
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB on inputs (0, 1), (0, 2), expected 1, but computed 0
2 Halted 0 ms 0 KB -