답안 #1118536

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1118536 2024-11-25T16:14:48 Z adaawf Vision Program (IOI19_vision) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
void construct_network(int h, int w, int k) {
    int x = 0, y = 0;
    vector<int> va;
    for (int i = 0; i <= 15; i++) {
        vector<int> v;
        for (int j = 0; j < h * w; j++) {
            if (j & (1 << i)) {
                v.push_back(j);
            }
        }
        if (add_or(v)) {
            if (add_xor(v)) va.push_back(i);
            else {
                x += (1 << i);
                y += (1 << i);
            }
        }
    }
    for (int i = 0; i < (1 << v.size()); i++) {
        int z = x, t = y;
        for (int j = 0; j < v.size(); j++) {
            if (i & (1 << j)) z += (1 << v[j]);
            else t += (1 << v[j]);
        }
        if (z < 0 || t < 0 || z >= h * w || t >= h * w || z > t) continue;
        int u = z / h, v = z % h, uu = t / h, vv = t % h;
        if (abs(uu - u) + abs(vv - v) != k) continue;
        if (add_and(z, t)) {
            return;
        }
    }
    add_and(0, 1);
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:13:13: error: 'add_or' was not declared in this scope
   13 |         if (add_or(v)) {
      |             ^~~~~~
vision.cpp:14:17: error: 'add_xor' was not declared in this scope
   14 |             if (add_xor(v)) va.push_back(i);
      |                 ^~~~~~~
vision.cpp:21:31: error: 'v' was not declared in this scope
   21 |     for (int i = 0; i < (1 << v.size()); i++) {
      |                               ^
vision.cpp:30:13: error: 'add_and' was not declared in this scope
   30 |         if (add_and(z, t)) {
      |             ^~~~~~~
vision.cpp:34:5: error: 'add_and' was not declared in this scope
   34 |     add_and(0, 1);
      |     ^~~~~~~