답안 #301103

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
301103 2020-09-17T16:27:24 Z dantoh000 Vision Program (IOI19_vision) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
//#include "vision.h"
using namespace std;
vector<int> rdiag[405];
vector<int> ldiag[405];
int rdiagxor[405];
int ldiagxor[405];
int rdiagor[405];
int ldiagor[405];
int h,w;
int test(int dist){
    //printf("test dist %d\n",dist);
    vector<int> retl;
    for (int i = 0; i < h+w-1; i++){
        vector<int> X;
        vector<int> O;
        for (int j = 0; j <= dist; j++){
            if (i+j > h+w-2) continue;
            X.push_back(ldiagxor[i+j]);
            O.push_back(ldiagor[i+j]);
        }
        //printf("adding range [%d-%d]\n",i,i+dist);
        retl.push_back(add_and({add_or(O), add_not(add_xor(X))}));
    }
    //printf("ldiag done\n");
    vector<int> retr;
    for (int i = 0; i < h+w-1; i++){
        vector<int> X;
        vector<int> O;
        for (int j = 0; j <= dist; j++){
            if (i+j > h+w-2) continue;
            X.push_back(rdiagxor[i+j]);
            O.push_back(rdiagor[i+j]);
        }
        //printf("adding range [%d-%d]\n",i,i+dist);
        retr.push_back(add_and({add_or(O), add_not(add_xor(X))}));
    }
    //printf("rdiag done\n");
    //printf("test dist %d: retl %d, retr %d\n",dist,retl.size(),retr.size());
    return add_and({add_or(retl), add_or(retr)});
}
void construct_network(int H, int W, int K) {
    h = H, w = W;
    for (int i = 0; i < H; i++){
        for (int j = 0; j < W; j++){
            ldiag[i+j].push_back(i*W+j);
            rdiag[H-1-i+j].push_back(i*W+j);
        }
    }
    for (int i = 0; i < H+W; i++){
        if (ldiag[i].size()) ldiagxor[i] = add_xor(ldiag[i]);
        if (ldiag[i].size()) ldiagor[i] = add_or(ldiag[i]);
        if (rdiag[i].size()) rdiagxor[i] = add_xor(rdiag[i]);
        if (rdiag[i].size()) rdiagor[i] = add_or(rdiag[i]);
    }
    //printf("start test\n");
    add_and({test(K), add_not(test(K-1))});
}

Compilation message

vision.cpp: In function 'int test(int)':
vision.cpp:23:33: error: 'add_or' was not declared in this scope
   23 |         retl.push_back(add_and({add_or(O), add_not(add_xor(X))}));
      |                                 ^~~~~~
vision.cpp:23:52: error: 'add_xor' was not declared in this scope
   23 |         retl.push_back(add_and({add_or(O), add_not(add_xor(X))}));
      |                                                    ^~~~~~~
vision.cpp:23:44: error: 'add_not' was not declared in this scope
   23 |         retl.push_back(add_and({add_or(O), add_not(add_xor(X))}));
      |                                            ^~~~~~~
vision.cpp:23:24: error: 'add_and' was not declared in this scope
   23 |         retl.push_back(add_and({add_or(O), add_not(add_xor(X))}));
      |                        ^~~~~~~
vision.cpp:36:33: error: 'add_or' was not declared in this scope
   36 |         retr.push_back(add_and({add_or(O), add_not(add_xor(X))}));
      |                                 ^~~~~~
vision.cpp:36:52: error: 'add_xor' was not declared in this scope
   36 |         retr.push_back(add_and({add_or(O), add_not(add_xor(X))}));
      |                                                    ^~~~~~~
vision.cpp:36:44: error: 'add_not' was not declared in this scope
   36 |         retr.push_back(add_and({add_or(O), add_not(add_xor(X))}));
      |                                            ^~~~~~~
vision.cpp:36:24: error: 'add_and' was not declared in this scope
   36 |         retr.push_back(add_and({add_or(O), add_not(add_xor(X))}));
      |                        ^~~~~~~
vision.cpp:40:21: error: 'add_or' was not declared in this scope
   40 |     return add_and({add_or(retl), add_or(retr)});
      |                     ^~~~~~
vision.cpp:40:12: error: 'add_and' was not declared in this scope
   40 |     return add_and({add_or(retl), add_or(retr)});
      |            ^~~~~~~
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:51:44: error: 'add_xor' was not declared in this scope
   51 |         if (ldiag[i].size()) ldiagxor[i] = add_xor(ldiag[i]);
      |                                            ^~~~~~~
vision.cpp:52:43: error: 'add_or' was not declared in this scope
   52 |         if (ldiag[i].size()) ldiagor[i] = add_or(ldiag[i]);
      |                                           ^~~~~~
vision.cpp:53:44: error: 'add_xor' was not declared in this scope
   53 |         if (rdiag[i].size()) rdiagxor[i] = add_xor(rdiag[i]);
      |                                            ^~~~~~~
vision.cpp:54:43: error: 'add_or' was not declared in this scope
   54 |         if (rdiag[i].size()) rdiagor[i] = add_or(rdiag[i]);
      |                                           ^~~~~~
vision.cpp:57:23: error: 'add_not' was not declared in this scope
   57 |     add_and({test(K), add_not(test(K-1))});
      |                       ^~~~~~~
vision.cpp:57:5: error: 'add_and' was not declared in this scope
   57 |     add_and({test(K), add_not(test(K-1))});
      |     ^~~~~~~