답안 #222569

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
222569 2020-04-13T11:07:13 Z VEGAnn Vision Program (IOI19_vision) C++14
컴파일 오류
0 ms 0 KB
#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 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);
        add_and({id, i * m + j});

        return;
    }

    for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++){
        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);
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:25:17: error: 'i' was not declared in this scope
         int x = i, y = j - K;
                 ^
vision.cpp:28:23: error: 'y' was not declared in this scope
             if (ok(x, y))
                       ^
vision.cpp:31:18: error: 'y' was not declared in this scope
             x--; y++;
                  ^
vision.cpp:35:23: error: 'y' was not declared in this scope
             if (ok(x, y))
                       ^
vision.cpp:38:18: error: 'y' was not declared in this scope
             x++; y++;
                  ^
vision.cpp:42:23: error: 'y' was not declared in this scope
             if (ok(x, y))
                       ^
vision.cpp:45:18: error: 'y' was not declared in this scope
             x++; y--;
                  ^
vision.cpp:49:23: error: 'y' was not declared in this scope
             if (ok(x, y))
                       ^
vision.cpp:52:18: error: 'y' was not declared in this scope
             x--; y--;
                  ^
vision.cpp:55:22: error: continue statement not within a loop
         if (!sz(vc)) continue;
                      ^~~~~~~~
vision.cpp:58:30: error: 'j' was not declared in this scope
         add_and({id, i * m + j});
                              ^
vision.cpp:58:32: error: could not convert '{id, <expression error>}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
         add_and({id, i * m + j});
                                ^