# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
819953 |
2023-08-10T16:15:57 Z |
Marco_Escandon |
Keys (IOI21_keys) |
C++17 |
|
3000 ms |
43644 KB |
#include "keys.h"
#include <cassert>
#include <cstdio>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<vector<pair<ll,ll>>> cad;
std::vector<int> find_reachable(std::vector<int> r, std::vector<int> u, std::vector<int> v1, std::vector<int> c)
{
ll n=r.size();
ll m=u.size();cad.resize(n*2+1);
for(int i=0; i<m; i++){
cad[u[i]].push_back({v1[i],c[i]});
cad[v1[i]].push_back({u[i],c[i]});
}
ll bs=n+3;
vector<int> sol(n,0);
for(int i=0; i<n; i++)
{
vector<ll> v(n*2,0),lla(n*2,0);
vector<vector<ll>> ca(n*2+1);
queue<ll> q;
q.push(i);
while(!q.empty())
{
ll a=q.front();q.pop();
if(v[a]==0)
{
v[a]=2;
lla[r[a]]=1;
for(auto j:ca[r[a]])
{
q.push(j);
}
ca[r[a]].clear();
for(auto j:cad[a])
{
if(lla[j.second]==1)
{
q.push(j.first);
}
ca[j.second].push_back(j.first);
}
}
}
ll cont=0;
for(auto j:v)
{
if(j==2)
cont++;
//cout<<j<<" ";
}
//cout<<"\n";
sol[i]=cont;
bs=min(bs,cont);
}
for(int i=0; i<n; i++)
if(sol[i]==bs)
sol[i]=1;
else sol[i]=0;
return sol;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
2 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
0 ms |
212 KB |
Output is correct |
15 |
Correct |
3 ms |
212 KB |
Output is correct |
16 |
Correct |
0 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
300 KB |
Output is correct |
20 |
Correct |
1 ms |
300 KB |
Output is correct |
21 |
Correct |
3 ms |
340 KB |
Output is correct |
22 |
Correct |
1 ms |
296 KB |
Output is correct |
23 |
Correct |
3 ms |
212 KB |
Output is correct |
24 |
Correct |
3 ms |
212 KB |
Output is correct |
25 |
Correct |
4 ms |
340 KB |
Output is correct |
26 |
Correct |
4 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
2 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
0 ms |
212 KB |
Output is correct |
15 |
Correct |
3 ms |
212 KB |
Output is correct |
16 |
Correct |
0 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
300 KB |
Output is correct |
20 |
Correct |
1 ms |
300 KB |
Output is correct |
21 |
Correct |
3 ms |
340 KB |
Output is correct |
22 |
Correct |
1 ms |
296 KB |
Output is correct |
23 |
Correct |
3 ms |
212 KB |
Output is correct |
24 |
Correct |
3 ms |
212 KB |
Output is correct |
25 |
Correct |
4 ms |
340 KB |
Output is correct |
26 |
Correct |
4 ms |
340 KB |
Output is correct |
27 |
Correct |
108 ms |
824 KB |
Output is correct |
28 |
Correct |
106 ms |
848 KB |
Output is correct |
29 |
Correct |
117 ms |
832 KB |
Output is correct |
30 |
Correct |
75 ms |
468 KB |
Output is correct |
31 |
Correct |
6 ms |
468 KB |
Output is correct |
32 |
Correct |
1 ms |
340 KB |
Output is correct |
33 |
Correct |
4 ms |
468 KB |
Output is correct |
34 |
Correct |
59 ms |
516 KB |
Output is correct |
35 |
Correct |
66 ms |
500 KB |
Output is correct |
36 |
Correct |
272 ms |
736 KB |
Output is correct |
37 |
Correct |
243 ms |
868 KB |
Output is correct |
38 |
Correct |
363 ms |
780 KB |
Output is correct |
39 |
Correct |
337 ms |
780 KB |
Output is correct |
40 |
Correct |
15 ms |
552 KB |
Output is correct |
41 |
Correct |
64 ms |
596 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Execution timed out |
3045 ms |
43644 KB |
Time limit exceeded |
11 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
2 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
0 ms |
212 KB |
Output is correct |
15 |
Correct |
3 ms |
212 KB |
Output is correct |
16 |
Correct |
0 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
300 KB |
Output is correct |
20 |
Correct |
1 ms |
300 KB |
Output is correct |
21 |
Correct |
3 ms |
340 KB |
Output is correct |
22 |
Correct |
1 ms |
296 KB |
Output is correct |
23 |
Correct |
3 ms |
212 KB |
Output is correct |
24 |
Correct |
3 ms |
212 KB |
Output is correct |
25 |
Correct |
4 ms |
340 KB |
Output is correct |
26 |
Correct |
4 ms |
340 KB |
Output is correct |
27 |
Correct |
108 ms |
824 KB |
Output is correct |
28 |
Correct |
106 ms |
848 KB |
Output is correct |
29 |
Correct |
117 ms |
832 KB |
Output is correct |
30 |
Correct |
75 ms |
468 KB |
Output is correct |
31 |
Correct |
6 ms |
468 KB |
Output is correct |
32 |
Correct |
1 ms |
340 KB |
Output is correct |
33 |
Correct |
4 ms |
468 KB |
Output is correct |
34 |
Correct |
59 ms |
516 KB |
Output is correct |
35 |
Correct |
66 ms |
500 KB |
Output is correct |
36 |
Correct |
272 ms |
736 KB |
Output is correct |
37 |
Correct |
243 ms |
868 KB |
Output is correct |
38 |
Correct |
363 ms |
780 KB |
Output is correct |
39 |
Correct |
337 ms |
780 KB |
Output is correct |
40 |
Correct |
15 ms |
552 KB |
Output is correct |
41 |
Correct |
64 ms |
596 KB |
Output is correct |
42 |
Execution timed out |
3045 ms |
43644 KB |
Time limit exceeded |
43 |
Halted |
0 ms |
0 KB |
- |