Submission #501519

#TimeUsernameProblemLanguageResultExecution timeMemory
501519aryan12Vision Program (IOI19_vision)C++17
8 / 100
1 ms296 KiB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std; 

//expected to work for subtasks: 1, 2, 3, 5, 6

void construct_network(int H, int W, int K) {
	int omg = add_and({0});
	//cout << omg << endl;
	if(omg != 0) {
		//cout << "boom" << endl;
		vector<int> temp;
		for(int newr = K; newr >= 0; newr--) {
			int newc = K - newr;
			int r = newr, c = newc;
			if(0 <= r && r < H && 0 <= c && c < W) {
				temp.push_back(r * W + c);
			}
			c = -newc;
			if(newr != K && newr != 0 && 0 <= r && r < H && 0 <= c && c < W) {
				temp.push_back(r * W + c);
			}
		}
		if(temp.size() != 0) {
			int res1 = add_and({0}), res2 = add_or(temp);
			int x = add_and({H * W + 1, H * W + 2});
			return;
		}
		add_not(1);
		return;
	}
	int cnt = 1;
	for(int i = 0; i < H; i++) {
		for(int j = 0; j < W; j++) {
			//to check if this has a black cell;
			//to check if every kth distance has a black cell or not
			//will only check between 90 and 180 degrees (inclusive)
			vector<int> temp;
			for(int newr = K; newr >= 0; newr--) {
				int newc = K - newr;
				int r = i + newr, c = j + newc;
				if(0 <= r && r < H && 0 <= c && c < W) {
					temp.push_back(r * W + c);
				}
				c = j - newc;
				if(newr != K && newr != 0 && 0 <= r && r < H && 0 <= c && c < W) {
					temp.push_back(r * W + c);
				}
			}
			if(temp.size() != 0) {
				int res1 = add_and({i * W + j});
				int res2 = add_or(temp);
				cnt += 2;
			}
		}
	}
	int cnt2 = 0;
	for(int i = 1; i < cnt; i += 2) {
		add_and({H * W + i, H * W + i + 1});
		cnt2++;
	}
	vector<int> finalans;
	for(int i = cnt; i < cnt + cnt2; i++) {
		finalans.push_back(H * W + i);
	}
	int x = add_or(finalans);
	/*std::vector<int> Ns;
	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);*/
}

Compilation message (stderr)

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:25:8: warning: unused variable 'res1' [-Wunused-variable]
   25 |    int res1 = add_and({0}), res2 = add_or(temp);
      |        ^~~~
vision.cpp:25:29: warning: unused variable 'res2' [-Wunused-variable]
   25 |    int res1 = add_and({0}), res2 = add_or(temp);
      |                             ^~~~
vision.cpp:26:8: warning: unused variable 'x' [-Wunused-variable]
   26 |    int x = add_and({H * W + 1, H * W + 2});
      |        ^
vision.cpp:51:9: warning: unused variable 'res1' [-Wunused-variable]
   51 |     int res1 = add_and({i * W + j});
      |         ^~~~
vision.cpp:52:9: warning: unused variable 'res2' [-Wunused-variable]
   52 |     int res2 = add_or(temp);
      |         ^~~~
vision.cpp:66:6: warning: unused variable 'x' [-Wunused-variable]
   66 |  int x = add_or(finalans);
      |      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...