# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
501519 | aryan12 | Vision Program (IOI19_vision) | C++17 | 1 ms | 296 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |