| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1356618 | Faisal_Saqib | Keys (IOI21_keys) | C++20 | Compilation error | 0 ms | 0 KiB |
#include <vector>
#include <bits/stdc++.h>
const int N=1e5+10;
vector<pair<int,int>> ma[N];
vector<int> ct[N];
bool hv[N],vis[N];
std::vector<int> find_reachable(std::vector<int> r, std::vector<int> u, std::vector<int> v, std::vector<int> c) {
int n=r.size();
vector<int> ans(r.size());
for(int j=0;j<u.size();j++)
{
ma[u[j]].push_back({c[j],v[j]});
ma[v[j]].push_back({c[j],u[j]});
}
int mi=n;
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
vis[j]=hv[j]=0;
ct[j].clear();
}
queue<int> q;
q.push(i);
hv[r[i]]=1;
vis[i]=1;
while(q.size())
{
int x=q.front();
q.pop();
ans[i]++;
for(auto y:ct[r[x]])
{
if(!vis[y])
{
q.push(y);
hv[r[y]]=1;
vis[y]=1;
}
}
for(auto [w,y]:ma[x])
{
if(hv[w] and !vis[y])
{
q.push(y);
hv[r[y]]=1;
vis[y]=1;
}
if(!hv[w])ct[w].push_back(y);
}
}
mi=min(mi,ans[i]);
}
for(int j=0;j<n;j++)ans[j]=(ans[j]==mi);
return ans;
}Compilation message (stderr)
keys.cpp:4:8: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
4 | vector<pair<int,int>> ma[N];
| ^~~~
| std::pair
In file included from /usr/include/c++/13/bits/stl_algobase.h:64,
from /usr/include/c++/13/vector:62,
from keys.cpp:1:
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
187 | struct pair
| ^~~~
keys.cpp:4:8: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
4 | vector<pair<int,int>> ma[N];
| ^~~~
| std::pair
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
187 | struct pair
| ^~~~
keys.cpp:4:8: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
4 | vector<pair<int,int>> ma[N];
| ^~~~
| std::pair
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
187 | struct pair
| ^~~~
keys.cpp:4:8: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
4 | vector<pair<int,int>> ma[N];
| ^~~~
| std::pair
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
187 | struct pair
| ^~~~
keys.cpp:4:8: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
4 | vector<pair<int,int>> ma[N];
| ^~~~
| std::pair
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
187 | struct pair
| ^~~~
keys.cpp:4:8: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
4 | vector<pair<int,int>> ma[N];
| ^~~~
| std::pair
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
187 | struct pair
| ^~~~
keys.cpp:4:8: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
4 | vector<pair<int,int>> ma[N];
| ^~~~
| std::pair
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
187 | struct pair
| ^~~~
keys.cpp:4:8: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
4 | vector<pair<int,int>> ma[N];
| ^~~~
| std::pair
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
187 | struct pair
| ^~~~
keys.cpp:4:8: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
4 | vector<pair<int,int>> ma[N];
| ^~~~
| std::pair
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
187 | struct pair
| ^~~~
keys.cpp:4:1: error: 'vector' does not name a type
4 | vector<pair<int,int>> ma[N];
| ^~~~~~
keys.cpp:5:1: error: 'vector' does not name a type
5 | vector<int> ct[N];
| ^~~~~~
keys.cpp: In function 'std::vector<int> find_reachable(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
keys.cpp:9:9: error: 'vector' was not declared in this scope
9 | vector<int> ans(r.size());
| ^~~~~~
keys.cpp:9:9: note: suggested alternatives:
In file included from /usr/include/c++/13/vector:66:
/usr/include/c++/13/bits/stl_vector.h:428:11: note: 'std::vector'
428 | class vector : protected _Vector_base<_Tp, _Alloc>
| ^~~~~~
/usr/include/c++/13/vector:86:13: note: 'std::pmr::vector'
86 | using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
| ^~~~~~
keys.cpp:9:16: error: expected primary-expression before 'int'
9 | vector<int> ans(r.size());
| ^~~
keys.cpp:12:17: error: 'ma' was not declared in this scope; did you mean 'fma'?
12 | ma[u[j]].push_back({c[j],v[j]});
| ^~
| fma
keys.cpp:21:25: error: 'ct' was not declared in this scope; did you mean 'c'?
21 | ct[j].clear();
| ^~
| c
keys.cpp:24:17: error: 'queue' was not declared in this scope; did you mean 'std::queue'?
24 | queue<int> q;
| ^~~~~
| std::queue
In file included from /usr/include/c++/13/queue:66,
from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:157,
from keys.cpp:2:
/usr/include/c++/13/bits/stl_queue.h:96:11: note: 'std::queue' declared here
96 | class queue
| ^~~~~
keys.cpp:24:23: error: expected primary-expression before 'int'
24 | queue<int> q;
| ^~~
keys.cpp:25:17: error: 'q' was not declared in this scope
25 | q.push(i);
| ^
keys.cpp:32:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
32 | ans[i]++;
| ^~~
| abs
keys.cpp:33:36: error: 'ct' was not declared in this scope; did you mean 'c'?
33 | for(auto y:ct[r[x]])
| ^~
| c
keys.cpp:42:40: error: 'ma' was not declared in this scope; did you mean 'mi'?
42 | for(auto [w,y]:ma[x])
| ^~
| mi
keys.cpp:50:43: error: 'ct' was not declared in this scope; did you mean 'c'?
50 | if(!hv[w])ct[w].push_back(y);
| ^~
| c
keys.cpp:53:27: error: 'ans' was not declared in this scope; did you mean 'abs'?
53 | mi=min(mi,ans[i]);
| ^~~
| abs
keys.cpp:53:20: error: 'min' was not declared in this scope
53 | mi=min(mi,ans[i]);
| ^~~
keys.cpp:53:20: note: suggested alternatives:
In file included from /usr/include/c++/13/algorithm:61,
from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51:
/usr/include/c++/13/bits/stl_algo.h:5785:5: note: 'std::min'
5785 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
In file included from /usr/include/c++/13/tuple:44,
from /usr/include/c++/13/bits/uses_allocator_args.h:38,
from /usr/include/c++/13/bits/memory_resource.h:41,
from /usr/include/c++/13/vector:80:
/usr/include/c++/13/bits/ranges_util.h:738:29: note: 'std::ranges::min'
738 | inline constexpr __min_fn min{};
| ^~~
keys.cpp:56:29: error: 'ans' was not declared in this scope; did you mean 'abs'?
56 | for(int j=0;j<n;j++)ans[j]=(ans[j]==mi);
| ^~~
| abs
keys.cpp:57:16: error: 'ans' was not declared in this scope; did you mean 'abs'?
57 | return ans;
| ^~~
| abs