Submission #336490

#TimeUsernameProblemLanguageResultExecution timeMemory
336490aryan12Vision Program (IOI19_vision)C++17
33 / 100
2 ms1128 KiB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
int a[N];

void MakeItGood(int h, int w) {
    for(int i = 0; i < h * w - 1; i++) {
        a[i] = 0;
    }
}

/*int add_and(vector<int> x) {
    int ans = 1;
    for(int i = 0; i < x.size(); i++) {
        ans &= a[x[i]];
    }
    cout << ans << endl;
    return ans;
}

int add_or(vector<int> x) {
    int ans = 0;
    for(int i = 0; i < x.size(); i++) {
        ans |= a[x[i]];
    }
    cout << ans << endl;
    return ans;
}

int add_xor(vector<int> x) {
    int ans = 0;
    for(int i = 0; i < x.size(); i++) {
        ans ^= a[x[i]];
    }
    cout << ans << endl;
    return ans;
}

int add_not(int x) {
    cout << 1 - x << endl;
    return (1 - x);
}*/

void construct_network(int H, int W, int K) {
    vector<int> x;
    for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) {
            for(int y = 0; y <= K; y++) {
                if(i + y < H) {
                    if(j + K - y < W) {
                        //cout << i * W + j << " " << (i + y) * W + j + K - y << endl;
                        x.push_back(add_and({i * W + j, (i + y) * W + j + K - y}));
                    }
                    if(j - K + y >= 0) {
                        //cout << i * W + j << " " << (i + y) * W + j - K + y << endl;
                        x.push_back(add_and({i * W + j, (i + y) * W + j - K + y}));
                    }
                }
                if(i - y >= 0) {
                    if(j + K - y < W) {
                        //cout << i * W + j << " " << (i - y) * W + j + K - y << endl;
                        x.push_back(add_and({i * W + j, (i - y) * W + j + K - y}));
                    }
                    if(j - K + y >= 0) {
                        //cout << i * W + j << " " << (i - y) * W + j - K + y << endl;
                        x.push_back(add_and({i * W + j, (i - y) * W + j - K + y}));
                    }
                }
            }
        }
    }
    add_or(x);
}

/*int main() {
    int h, w, k;
    cin >> h >> w >> k;
    while(true) {
        int r1;
        cin >> r1;
        if(r1 == -1)
            break;
        int c1, r2, c2;
        cin >> c1 >> r2 >> c2;
        MakeItGood(h, w);
        a[r1 * w + c1] = 1;
        a[r2 * w + c2] = 1;
        construct_network(h, w, k);
    }
}*/
#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...