제출 #501517

#제출 시각아이디문제언어결과실행 시간메모리
501517aryan12Vision Program (IOI19_vision)C++17
44 / 100
10 ms2244 KiB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std; 

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

void construct_network(int H, int W, int K) {
	int omg = add_and({0});

	if(omg == 1) {
		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);*/
}

컴파일 시 표준 에러 (stderr) 메시지

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:24:8: warning: unused variable 'res1' [-Wunused-variable]
   24 |    int res1 = add_and({0}), res2 = add_or(temp);
      |        ^~~~
vision.cpp:24:29: warning: unused variable 'res2' [-Wunused-variable]
   24 |    int res1 = add_and({0}), res2 = add_or(temp);
      |                             ^~~~
vision.cpp:25:8: warning: unused variable 'x' [-Wunused-variable]
   25 |    int x = add_and({H * W + 1, H * W + 2});
      |        ^
vision.cpp:50:9: warning: unused variable 'res1' [-Wunused-variable]
   50 |     int res1 = add_and({i * W + j});
      |         ^~~~
vision.cpp:51:9: warning: unused variable 'res2' [-Wunused-variable]
   51 |     int res2 = add_or(temp);
      |         ^~~~
vision.cpp:65:6: warning: unused variable 'x' [-Wunused-variable]
   65 |  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...