Submission #894368

#TimeUsernameProblemLanguageResultExecution timeMemory
894368Trisanu_DasKeys (IOI21_keys)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; vector<int> find_reachable(vector<int> r, vector<int> u, vector<int> v, vector<int> c) { int n = r.size(); vector<int> ans(n, 0); vector<bool> vi(n, 0), <bool> keys(n, 0); int m = n; for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) vi[j] = 0, keys[j] = 0; vi[i] = 1; keys[r[i]] = 1; for(int k = 0; k < n; k++) { for(int j = 0; j < u.size(); j++) { if(keys[c[j]]){ if(vi[u[j]]) vi[v[j]] = 1, keys[r[v[j]]] = 1; if(vi[v[j]]) vi[u[j]] = 1, keys[r[u[j]]] = 1; } } } int c = 0; for(int j = 0; j < n; j++) if(vi[j]) c++; m = min(c, m); ans[i] = c; } for(int i = 0; i < n; i++) ans[i] = ans[i] == m ? 1 : 0; return ans; }

Compilation message (stderr)

keys.cpp: In function 'std::vector<int> find_reachable(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
keys.cpp:7:28: error: expected unqualified-id before '<' token
    7 |     vector<bool> vi(n, 0), <bool> keys(n, 0);
      |                            ^
keys.cpp:10:47: error: 'keys' was not declared in this scope
   10 |         for(int j = 0; j < n; j++) vi[j] = 0, keys[j] = 0;
      |                                               ^~~~
keys.cpp:12:9: error: 'keys' was not declared in this scope
   12 |         keys[r[i]] = 1;
      |         ^~~~
keys.cpp:14:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |             for(int j = 0; j < u.size(); j++) {
      |                            ~~^~~~~~~~~~