Submission #447424

# Submission time Handle Problem Language Result Execution time Memory
447424 2021-07-26T09:53:49 Z Nodir_Bobiev Connecting Supertrees (IOI20_supertrees) C++17
Compilation error
0 ms 0 KB
#include "supertrees.h"
#include <bits/stdc++.h>
using namespace std ;

int construct(std::vector<std::vector<int>> p) {
      vector <vector <long>> ans;
      for(int i = 0; i < n; i ++){
            vector <long> row;
            row.resize(n);
            ans.push_back(row);
      }
      for(int i = 0; i < n; i ++){
            if( us[i] ) continue;
            for(int j = 0; j < n; j ++){
                if( p[i][j] ){
                    if( us[j] ) return 0;
                    us[j] = 1;
                    ans[i][j] = ans[j][1] = 1;
                }
            }
      }
      build(ans);
      return 1;
}

Compilation message

supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:7:26: error: 'n' was not declared in this scope
    7 |       for(int i = 0; i < n; i ++){
      |                          ^
supertrees.cpp:12:26: error: 'n' was not declared in this scope
   12 |       for(int i = 0; i < n; i ++){
      |                          ^
supertrees.cpp:13:17: error: 'us' was not declared in this scope
   13 |             if( us[i] ) continue;
      |                 ^~
supertrees.cpp:16:25: error: 'us' was not declared in this scope
   16 |                     if( us[j] ) return 0;
      |                         ^~
supertrees.cpp:17:21: error: 'us' was not declared in this scope
   17 |                     us[j] = 1;
      |                     ^~
supertrees.cpp:22:13: error: could not convert 'ans' from 'vector<vector<long int>>' to 'vector<vector<int>>'
   22 |       build(ans);
      |             ^~~
      |             |
      |             vector<vector<long int>>