답안 #588047

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
588047 2022-07-02T16:33:04 Z ogibogi2004 Vision Program (IOI19_vision) C++14
컴파일 오류
0 ms 0 KB
void construct_network(int H, int W, int K) {
    vector<int>table;
    for(int i=0;i<H*W;i++)table.push_back(i);
    vector<int>diag1,diag2,diag11,diag21;
    for(int s=0;s<H+W-1;s++)
    {
        vector<int>v;
        for(int i=0;i<H;i++)
        {
            for(int j=0;j<W;j++)
            {
                if(i+j==s)v.push_back(i*W+j);
            }
        }
        if(v.size()!=0)
        {
            diag1.push_back(add_or(v));
            diag11.push_back(add_and({diag1.back(),add_not(add_xor(v))}));
        }
    }
    for(int s=-(W-1);s<H;s++)
    {
        vector<int>v;
        for(int i=0;i<H;i++)
        {
            for(int j=0;j<W;j++)
            {
                if(i-j==s)v.push_back(i*W+j);
            }
        }
        if(v.size()!=0)
        {
            diag2.push_back(add_or(v));
            diag21.push_back(add_and({diag2.back(),add_not(add_xor(v))}));
        }
    }
    int f1,f2;
    vector<int>v1,v2;
    for(int i=0;i+K<diag1.size();i++)
    {
        vector<int>v;
        for(int j=i;j<=i+K;j++)v.push_back(diag1[j]);
        v1.push_back(add_and({add_not(add_xor(v)),add_or(v)}));
    }
    for(int i=0;i+K<diag2.size();i++)
    {
        vector<int>v;
        for(int j=i;j<=i+K;j++)v.push_back(diag2[j]);
        v2.push_back(add_and({add_not(add_xor(v)),add_or(v)}));
    }
    f1=add_and({add_or(v1),add_or(v2)});
    v1.clear();v2.clear();
    for(int i=0;i+K-1<diag1.size();i++)
    {
        vector<int>v;
        for(int j=i;j<=i+K-1;j++)v.push_back(diag1[j]);
        v1.push_back(add_and({add_not(add_xor(v)),add_or(v)}));
    }
    for(int i=0;i+K-1<diag2.size();i++)
    {
        vector<int>v;
        for(int j=i;j<=i+K-1;j++)v.push_back(diag2[j]);
        v2.push_back(add_and({add_not(add_xor(v)),add_or(v)}));
    }
    f2=add_and({add_or(v1),add_or(v2)});
    add_and({f1,add_not(f2)});
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:2:5: error: 'vector' was not declared in this scope
    2 |     vector<int>table;
      |     ^~~~~~
vision.cpp:2:12: error: expected primary-expression before 'int'
    2 |     vector<int>table;
      |            ^~~
vision.cpp:3:27: error: 'table' was not declared in this scope; did you mean 'mutable'?
    3 |     for(int i=0;i<H*W;i++)table.push_back(i);
      |                           ^~~~~
      |                           mutable
vision.cpp:4:12: error: expected primary-expression before 'int'
    4 |     vector<int>diag1,diag2,diag11,diag21;
      |            ^~~
vision.cpp:7:16: error: expected primary-expression before 'int'
    7 |         vector<int>v;
      |                ^~~
vision.cpp:12:27: error: 'v' was not declared in this scope
   12 |                 if(i+j==s)v.push_back(i*W+j);
      |                           ^
vision.cpp:15:12: error: 'v' was not declared in this scope
   15 |         if(v.size()!=0)
      |            ^
vision.cpp:17:13: error: 'diag1' was not declared in this scope
   17 |             diag1.push_back(add_or(v));
      |             ^~~~~
vision.cpp:17:29: error: 'add_or' was not declared in this scope
   17 |             diag1.push_back(add_or(v));
      |                             ^~~~~~
vision.cpp:18:13: error: 'diag11' was not declared in this scope
   18 |             diag11.push_back(add_and({diag1.back(),add_not(add_xor(v))}));
      |             ^~~~~~
vision.cpp:18:60: error: 'add_xor' was not declared in this scope
   18 |             diag11.push_back(add_and({diag1.back(),add_not(add_xor(v))}));
      |                                                            ^~~~~~~
vision.cpp:18:52: error: 'add_not' was not declared in this scope
   18 |             diag11.push_back(add_and({diag1.back(),add_not(add_xor(v))}));
      |                                                    ^~~~~~~
vision.cpp:18:30: error: 'add_and' was not declared in this scope
   18 |             diag11.push_back(add_and({diag1.back(),add_not(add_xor(v))}));
      |                              ^~~~~~~
vision.cpp:23:16: error: expected primary-expression before 'int'
   23 |         vector<int>v;
      |                ^~~
vision.cpp:28:27: error: 'v' was not declared in this scope
   28 |                 if(i-j==s)v.push_back(i*W+j);
      |                           ^
vision.cpp:31:12: error: 'v' was not declared in this scope
   31 |         if(v.size()!=0)
      |            ^
vision.cpp:33:13: error: 'diag2' was not declared in this scope
   33 |             diag2.push_back(add_or(v));
      |             ^~~~~
vision.cpp:33:29: error: 'add_or' was not declared in this scope
   33 |             diag2.push_back(add_or(v));
      |                             ^~~~~~
vision.cpp:34:13: error: 'diag21' was not declared in this scope
   34 |             diag21.push_back(add_and({diag2.back(),add_not(add_xor(v))}));
      |             ^~~~~~
vision.cpp:34:60: error: 'add_xor' was not declared in this scope
   34 |             diag21.push_back(add_and({diag2.back(),add_not(add_xor(v))}));
      |                                                            ^~~~~~~
vision.cpp:34:52: error: 'add_not' was not declared in this scope
   34 |             diag21.push_back(add_and({diag2.back(),add_not(add_xor(v))}));
      |                                                    ^~~~~~~
vision.cpp:34:30: error: 'add_and' was not declared in this scope
   34 |             diag21.push_back(add_and({diag2.back(),add_not(add_xor(v))}));
      |                              ^~~~~~~
vision.cpp:38:12: error: expected primary-expression before 'int'
   38 |     vector<int>v1,v2;
      |            ^~~
vision.cpp:39:21: error: 'diag1' was not declared in this scope
   39 |     for(int i=0;i+K<diag1.size();i++)
      |                     ^~~~~
vision.cpp:41:16: error: expected primary-expression before 'int'
   41 |         vector<int>v;
      |                ^~~
vision.cpp:42:32: error: 'v' was not declared in this scope
   42 |         for(int j=i;j<=i+K;j++)v.push_back(diag1[j]);
      |                                ^
vision.cpp:43:9: error: 'v1' was not declared in this scope; did you mean 'f1'?
   43 |         v1.push_back(add_and({add_not(add_xor(v)),add_or(v)}));
      |         ^~
      |         f1
vision.cpp:43:47: error: 'v' was not declared in this scope
   43 |         v1.push_back(add_and({add_not(add_xor(v)),add_or(v)}));
      |                                               ^
vision.cpp:43:39: error: 'add_xor' was not declared in this scope
   43 |         v1.push_back(add_and({add_not(add_xor(v)),add_or(v)}));
      |                                       ^~~~~~~
vision.cpp:43:31: error: 'add_not' was not declared in this scope
   43 |         v1.push_back(add_and({add_not(add_xor(v)),add_or(v)}));
      |                               ^~~~~~~
vision.cpp:43:51: error: 'add_or' was not declared in this scope
   43 |         v1.push_back(add_and({add_not(add_xor(v)),add_or(v)}));
      |                                                   ^~~~~~
vision.cpp:43:22: error: 'add_and' was not declared in this scope
   43 |         v1.push_back(add_and({add_not(add_xor(v)),add_or(v)}));
      |                      ^~~~~~~
vision.cpp:45:21: error: 'diag2' was not declared in this scope
   45 |     for(int i=0;i+K<diag2.size();i++)
      |                     ^~~~~
vision.cpp:47:16: error: expected primary-expression before 'int'
   47 |         vector<int>v;
      |                ^~~
vision.cpp:48:32: error: 'v' was not declared in this scope
   48 |         for(int j=i;j<=i+K;j++)v.push_back(diag2[j]);
      |                                ^
vision.cpp:49:9: error: 'v2' was not declared in this scope; did you mean 'f2'?
   49 |         v2.push_back(add_and({add_not(add_xor(v)),add_or(v)}));
      |         ^~
      |         f2
vision.cpp:49:47: error: 'v' was not declared in this scope
   49 |         v2.push_back(add_and({add_not(add_xor(v)),add_or(v)}));
      |                                               ^
vision.cpp:49:39: error: 'add_xor' was not declared in this scope
   49 |         v2.push_back(add_and({add_not(add_xor(v)),add_or(v)}));
      |                                       ^~~~~~~
vision.cpp:49:31: error: 'add_not' was not declared in this scope
   49 |         v2.push_back(add_and({add_not(add_xor(v)),add_or(v)}));
      |                               ^~~~~~~
vision.cpp:49:51: error: 'add_or' was not declared in this scope
   49 |         v2.push_back(add_and({add_not(add_xor(v)),add_or(v)}));
      |                                                   ^~~~~~
vision.cpp:49:22: error: 'add_and' was not declared in this scope
   49 |         v2.push_back(add_and({add_not(add_xor(v)),add_or(v)}));
      |                      ^~~~~~~
vision.cpp:51:24: error: 'v1' was not declared in this scope; did you mean 'f1'?
   51 |     f1=add_and({add_or(v1),add_or(v2)});
      |                        ^~
      |                        f1
vision.cpp:51:17: error: 'add_or' was not declared in this scope
   51 |     f1=add_and({add_or(v1),add_or(v2)});
      |                 ^~~~~~
vision.cpp:51:35: error: 'v2' was not declared in this scope; did you mean 'f2'?
   51 |     f1=add_and({add_or(v1),add_or(v2)});
      |                                   ^~
      |                                   f2
vision.cpp:51:8: error: 'add_and' was not declared in this scope
   51 |     f1=add_and({add_or(v1),add_or(v2)});
      |        ^~~~~~~
vision.cpp:53:23: error: 'diag1' was not declared in this scope
   53 |     for(int i=0;i+K-1<diag1.size();i++)
      |                       ^~~~~
vision.cpp:55:16: error: expected primary-expression before 'int'
   55 |         vector<int>v;
      |                ^~~
vision.cpp:56:34: error: 'v' was not declared in this scope
   56 |         for(int j=i;j<=i+K-1;j++)v.push_back(diag1[j]);
      |                                  ^
vision.cpp:57:47: error: 'v' was not declared in this scope
   57 |         v1.push_back(add_and({add_not(add_xor(v)),add_or(v)}));
      |                                               ^
vision.cpp:57:39: error: 'add_xor' was not declared in this scope
   57 |         v1.push_back(add_and({add_not(add_xor(v)),add_or(v)}));
      |                                       ^~~~~~~
vision.cpp:57:31: error: 'add_not' was not declared in this scope
   57 |         v1.push_back(add_and({add_not(add_xor(v)),add_or(v)}));
      |                               ^~~~~~~
vision.cpp:59:23: error: 'diag2' was not declared in this scope
   59 |     for(int i=0;i+K-1<diag2.size();i++)
      |                       ^~~~~
vision.cpp:61:16: error: expected primary-expression before 'int'
   61 |         vector<int>v;
      |                ^~~
vision.cpp:62:34: error: 'v' was not declared in this scope
   62 |         for(int j=i;j<=i+K-1;j++)v.push_back(diag2[j]);
      |                                  ^
vision.cpp:63:47: error: 'v' was not declared in this scope
   63 |         v2.push_back(add_and({add_not(add_xor(v)),add_or(v)}));
      |                                               ^
vision.cpp:63:39: error: 'add_xor' was not declared in this scope
   63 |         v2.push_back(add_and({add_not(add_xor(v)),add_or(v)}));
      |                                       ^~~~~~~
vision.cpp:63:31: error: 'add_not' was not declared in this scope
   63 |         v2.push_back(add_and({add_not(add_xor(v)),add_or(v)}));
      |                               ^~~~~~~
vision.cpp:66:17: error: 'add_not' was not declared in this scope
   66 |     add_and({f1,add_not(f2)});
      |                 ^~~~~~~