제출 #302862

#제출 시각아이디문제언어결과실행 시간메모리
302862Jarif_Rahman슈퍼트리 잇기 (IOI20_supertrees)C++17
컴파일 에러
0 ms0 KiB
int construct(vector<vector<int>> p){
    v.clear();
    dsu1.clear();
    dsu2.clear();
    int n = p.size();
    v = vector<vector<int>>(n, vector<int>(n, 0));
    dsu1 = vector<vector<int>>(n);
    dsu2 = vector<int>(n);
    for(int i = 0; i < n ; i++) dsu1[i].pb(i);
    for(int i = 0; i < n; i++) dsu2[i] = i;
    vector <int> zot(3, 0);
    for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) if(i != j) zot[p[i][j]]++;
    for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) if(p[i][j] != 0) unite(i, j);
    bool bl = 1;
    for(auto sth: dsu1){
        if(sth.size() < 2) continue;
        if(sth.size() == 2){
            if(zot[1] == 0){
                bl = 0;
                break;
            }
            else continue;
        }
        for(int i = 0; i < sth.size(); i++) for(int j = 0; j < sth.size(); j++){
            if(i == j) continue;
            if(p[sth[i]][sth[j]] == 0){
                bl = 0;
                break;
            }
        }
    }
    if(!bl) return 0;
    for(auto sth: dsu1){
        if(sth.size() <= 2) continue;
        for(int i = 0; i < sth.size() - 1; i++){
            v[sth[i]][sth[i+1]] = 1;
            v[sth[i+1]][sth[i]] = 1;
        }
        if(zot[1] == 0){
            v[sth[0]][sth[sth.size() - 1]] = 1;
            v[sth[sth.size() - 1]][sth[0]] = 1;
        }
    }
    build(v);
    return 1;
}

컴파일 시 표준 에러 (stderr) 메시지

supertrees.cpp:1:15: error: 'vector' was not declared in this scope
    1 | int construct(vector<vector<int>> p){
      |               ^~~~~~
supertrees.cpp:1:22: error: 'vector' was not declared in this scope
    1 | int construct(vector<vector<int>> p){
      |                      ^~~~~~
supertrees.cpp:1:29: error: expected primary-expression before 'int'
    1 | int construct(vector<vector<int>> p){
      |                             ^~~