제출 #222586

#제출 시각아이디문제언어결과실행 시간메모리
222586VEGAnnVision Program (IOI19_vision)C++14
52 / 100
11 ms3064 KiB
#include <bits/stdc++.h>
#include "vision.h"
#define sz(x) ((int)x.size())
#define pii pair<int,int>
#define ft first
#define sd second
#define MP make_pair
#define PB push_back
using namespace std;
const int N = 100100;
vector<int> vc, res;
int n, m;

bool ok(int x, int y){
    return (x >= 0 && y >= 0 && x < n && y < m);
}

void construct_network(int H, int W, int K) {
    n = H; m = W;
    res.clear();

    if (max(H, W) > 100 && min(W, H) > 1){
        vc.clear();

        int i = 0, j = 0;
        int x = 0, y = -K;

        while (x != i - K){
            if (ok(x, y))
                vc.PB(x * m + y);

            x--; y++;
        }

        while (x != i){
            if (ok(x, y))
                vc.PB(x * m + y);

            x++; y++;
        }

        while (x != i + K){
            if (ok(x, y))
                vc.PB(x * m + y);

            x++; y--;
        }

        while (x != i){
            if (ok(x, y))
                vc.PB(x * m + y);

            x--; y--;
        }

        if (!sz(vc)) {
            add_and({0});
            return;
        }

        int id = add_or(vc);
        add_and({id, i * m + j});

        return;
    }

    for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++){

        if (i == n - 1 && j == m - 1)
            continue;

        vc.clear();

        int x = i, y = j - K;

        while (x != i - K){
            if (ok(x, y))
                vc.PB(x * m + y);

            x--; y++;
        }

        while (x != i){
            if (ok(x, y))
                vc.PB(x * m + y);

            x++; y++;
        }

        while (x != i + K){
            if (ok(x, y))
                vc.PB(x * m + y);

            x++; y--;
        }

        while (x != i){
            if (ok(x, y))
                vc.PB(x * m + y);

            x--; y--;
        }

        if (!sz(vc)) continue;

        int id = add_or(vc);
        res.PB(add_and({id, i * m + j}));
    }

    add_or(res);
}
#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...