제출 #293698

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

#define pb push_back
int n, m, k, cnt;

bool exist(int i, int j){
    return (0 <= i && i < n && 0 <= j && j < m);
}

int match(int i, int j){
    return i*m + j;
}

void construct_network(int H, int W, int K) {
    n = H, m = W, k = K, cnt = n*m-1;
    //printf("k = %d\n", k);

    vector<int> fin;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < m; j++){
            vector<int> temp;
            for (int x = i, y = j+k; y > j; x++, y--)
                if (exist(x, y))
                    temp.pb(match(x, y));//, printf("x = %d, y = %d\n", x, y);
            for (int x = i+k, y = j; x > i; x--, y--)
                if (exist(x, y))
                    temp.pb(match(x, y));

            //printf("i = %d, j = %d\n", i, j);
            if (temp.empty()) continue;
            //printf("i = %d, j = %d, temp not empty\n", i, j);

            add_or(temp), ++cnt;
            add_and({cnt, match(i, j)});
            fin.pb(++cnt);
        }

    //if (fin.empty()) printf("it is empty\n");
    add_or(fin);
}
#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...