답안 #144233

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
144233 2019-08-16T10:56:24 Z icypiggy Vision Program (IOI19_vision) C++14
컴파일 오류
0 ms 0 KB
#include "vision.h"
void construct_network(int H, int W, int K) {
    if(K==H+W-2) {
        add_or({add_and({0,H*W-1}),add_and({W-1,(H-1)*W})});
        return;
    }
    vector<int> vdiag[H+W-1];
    vector<int> vdiag2[H+W-1];
    int idx_diag[H+W-1];
    int idx_diag2[H+W-1];
    for(int i=0; i<H; i++) {
        for(int j=0; j<W; j++) {
            vdiag[i+j].push_back(i*W+j);
            vdiag2[H-1-i+j].push_back(i*W+j);
            //cout << "vdiag: " << i*W+j << " " << i+j << " " << H-1-i+j << "\n";
        }
    }
    for(int i=0; i<H+W-1; i++) {
        idx_diag[i] = add_or(vdiag[i]);
    }

    for(int i=0; i<H+W-1; i++) {
        idx_diag2[i] = add_or(vdiag2[i]);
    }
    vector<int> tmp;
    for(int i=0; i+K<H+W-1; i++) {
        tmp.push_back(add_and({idx_diag[i], idx_diag[i+K]}));
        tmp.push_back(add_and({idx_diag2[i], idx_diag2[i+K]}));
    }
    vector<int> tmp2; // if any fail, we fail
    vector<int> vtmp;
    vector<int> vtmp2;
    for(int i=H+W-2; i>K; i--) {
        vtmp.push_back(idx_diag[i]);
        vtmp2.push_back(idx_diag2[i]);
        //cout << idx_diag[i] << "!!!\n";
    }
    for(int i=0; i+K<H+W-2; i++) {
        /*cout << i << ": ";
        for(int i: vtmp) {
            cout << i << " ";
        }
        cout << "\n";*/
        tmp2.push_back(add_and({idx_diag[i], add_or(vtmp)}));
        tmp2.push_back(add_and({idx_diag2[i], add_or(vtmp2)}));
        vtmp.pop_back();
        vtmp2.pop_back();
    }
    //add_or(tmp);
    add_and({add_or(tmp), add_not(add_or(tmp2))});
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:7:5: error: 'vector' was not declared in this scope
     vector<int> vdiag[H+W-1];
     ^~~~~~
vision.cpp:7:5: note: suggested alternative:
In file included from /usr/include/c++/7/vector:64:0,
                 from vision.h:5,
                 from vision.cpp:1:
/usr/include/c++/7/bits/stl_vector.h:216:11: note:   'std::vector'
     class vector : protected _Vector_base<_Tp, _Alloc>
           ^~~~~~
vision.cpp:7:12: error: expected primary-expression before 'int'
     vector<int> vdiag[H+W-1];
            ^~~
vision.cpp:8:12: error: expected primary-expression before 'int'
     vector<int> vdiag2[H+W-1];
            ^~~
vision.cpp:13:13: error: 'vdiag' was not declared in this scope
             vdiag[i+j].push_back(i*W+j);
             ^~~~~
vision.cpp:14:13: error: 'vdiag2' was not declared in this scope
             vdiag2[H-1-i+j].push_back(i*W+j);
             ^~~~~~
vision.cpp:14:13: note: suggested alternative: 'idx_diag2'
             vdiag2[H-1-i+j].push_back(i*W+j);
             ^~~~~~
             idx_diag2
vision.cpp:19:30: error: 'vdiag' was not declared in this scope
         idx_diag[i] = add_or(vdiag[i]);
                              ^~~~~
vision.cpp:23:31: error: 'vdiag2' was not declared in this scope
         idx_diag2[i] = add_or(vdiag2[i]);
                               ^~~~~~
vision.cpp:23:31: note: suggested alternative: 'idx_diag2'
         idx_diag2[i] = add_or(vdiag2[i]);
                               ^~~~~~
                               idx_diag2
vision.cpp:25:12: error: expected primary-expression before 'int'
     vector<int> tmp;
            ^~~
vision.cpp:27:9: error: 'tmp' was not declared in this scope
         tmp.push_back(add_and({idx_diag[i], idx_diag[i+K]}));
         ^~~
vision.cpp:27:9: note: suggested alternative: 'tm'
         tmp.push_back(add_and({idx_diag[i], idx_diag[i+K]}));
         ^~~
         tm
vision.cpp:30:12: error: expected primary-expression before 'int'
     vector<int> tmp2; // if any fail, we fail
            ^~~
vision.cpp:31:12: error: expected primary-expression before 'int'
     vector<int> vtmp;
            ^~~
vision.cpp:32:12: error: expected primary-expression before 'int'
     vector<int> vtmp2;
            ^~~
vision.cpp:34:9: error: 'vtmp' was not declared in this scope
         vtmp.push_back(idx_diag[i]);
         ^~~~
vision.cpp:34:9: note: suggested alternative: 'tm'
         vtmp.push_back(idx_diag[i]);
         ^~~~
         tm
vision.cpp:35:9: error: 'vtmp2' was not declared in this scope
         vtmp2.push_back(idx_diag2[i]);
         ^~~~~
vision.cpp:44:9: error: 'tmp2' was not declared in this scope
         tmp2.push_back(add_and({idx_diag[i], add_or(vtmp)}));
         ^~~~
vision.cpp:44:9: note: suggested alternative: 'tm'
         tmp2.push_back(add_and({idx_diag[i], add_or(vtmp)}));
         ^~~~
         tm
vision.cpp:44:53: error: 'vtmp' was not declared in this scope
         tmp2.push_back(add_and({idx_diag[i], add_or(vtmp)}));
                                                     ^~~~
vision.cpp:44:53: note: suggested alternative: 'tm'
         tmp2.push_back(add_and({idx_diag[i], add_or(vtmp)}));
                                                     ^~~~
                                                     tm
vision.cpp:44:59: error: could not convert '{idx_diag[i], <expression error>}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
         tmp2.push_back(add_and({idx_diag[i], add_or(vtmp)}));
                                                           ^
vision.cpp:45:54: error: 'vtmp2' was not declared in this scope
         tmp2.push_back(add_and({idx_diag2[i], add_or(vtmp2)}));
                                                      ^~~~~
vision.cpp:45:61: error: could not convert '{idx_diag2[i], <expression error>}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
         tmp2.push_back(add_and({idx_diag2[i], add_or(vtmp2)}));
                                                             ^
vision.cpp:50:21: error: 'tmp' was not declared in this scope
     add_and({add_or(tmp), add_not(add_or(tmp2))});
                     ^~~
vision.cpp:50:21: note: suggested alternative: 'tm'
     add_and({add_or(tmp), add_not(add_or(tmp2))});
                     ^~~
                     tm
vision.cpp:50:42: error: 'tmp2' was not declared in this scope
     add_and({add_or(tmp), add_not(add_or(tmp2))});
                                          ^~~~
vision.cpp:50:42: note: suggested alternative: 'tm'
     add_and({add_or(tmp), add_not(add_or(tmp2))});
                                          ^~~~
                                          tm
vision.cpp:50:49: error: could not convert '{<expression error>, <expression error>}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
     add_and({add_or(tmp), add_not(add_or(tmp2))});
                                                 ^