Submission #424504

#TimeUsernameProblemLanguageResultExecution timeMemory
424504MrFranchoConnecting Supertrees (IOI20_supertrees)C++14
Compilation error
0 ms0 KiB
#include "supertrees.h" #include <bits/stdc++.h> using namespace std; int construct(vector<vector<int>> p) { int N = p.size(); vector<int> group(N,-1); bool vis[N]{}; vector<vector<int>> answer(N); for(int i = 0; i < N; i++) { answer[i].assign(N,0); } for (int i = 0; i < N; i++) { if(!vis[i]) { vis[i] = true; group[i] = [i]; for(int j = 0; j < N; j++) { if(p[i][j]) { if(vis[j]) return 0; vis[j] = true; answer[i][j] = answer[j][i] = 1; group[j] = i; } } } } /*for(int i = 0; i < connectedGroups.size(); i++) { cout << i << ":\n"; for(auto x: connectedGroups[i]) cout << x << endl; }*/ for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { if(i != j && (group[i] == group[j]) != p[i][j]) { return 0; } } } build(answer); return 1; }

Compilation message (stderr)

supertrees.cpp: In lambda function:
supertrees.cpp:18:24: error: expected '{' before ';' token
   18 |          group[i] = [i];
      |                        ^
supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:18:24: error: cannot convert 'construct(std::vector<std::vector<int> >)::<lambda()>' to '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} in assignment