Submission #1037000

# Submission time Handle Problem Language Result Execution time Memory
1037000 2024-07-27T21:17:42 Z aaaaaarroz Keys (IOI21_keys) C++17
37 / 100
3000 ms 32812 KB
    #include <bits/stdc++.h>
     
    using namespace std;
     
    const int nx=3e5+5;
     
    int n, m, mn=INT_MAX, p[nx];
    vector<pair<int, int>> d[nx];
     
    std::vector<int> find_reachable(std::vector<int> r, std::vector<int> u, std::vector<int> v, std::vector<int> c) {
    	n=r.size(), m=u.size();
    	for (int i=0; i<m; i++) d[u[i]].push_back({v[i], c[i]}), d[v[i]].push_back({u[i], c[i]});
    	for (int i=0; i<n; i++)
        {
            vector<int> k(n), w[n], vs(n);
            queue<int> q;
            int cnt=0;
            vs[i]=1;
            q.push(i);
            while (!q.empty())
            {
                auto u=q.front();
                cnt++;
                q.pop();
                if (!k[r[u]])
                {
                    k[r[u]]=1;
                    for (auto x:w[r[u]]) if (!vs[x]) vs[x]=1, q.push(x);
                }
                for (auto [v, t]:d[u]) 
                {
                    if (!vs[v])
                    {
                        if (k[t]) vs[v]=1, q.push(v);
                        else w[t].push_back(v);
                    }
                }
            }
            p[i]=cnt;
            //cout<<"debug "<<i<<' '<<cnt<<'\n';
            mn=min(mn, p[i]);
        }
        vector<int> ans;
        for (int i=0; i<n; i++) ans.push_back(mn==p[i]); 
    	return ans;
    }
# Verdict Execution time Memory Grader output
1 Correct 1 ms 7256 KB Output is correct
2 Correct 1 ms 7260 KB Output is correct
3 Correct 1 ms 7260 KB Output is correct
4 Correct 2 ms 7260 KB Output is correct
5 Correct 1 ms 7260 KB Output is correct
6 Correct 1 ms 7492 KB Output is correct
7 Correct 2 ms 7272 KB Output is correct
8 Correct 2 ms 7260 KB Output is correct
9 Correct 2 ms 7260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 7256 KB Output is correct
2 Correct 1 ms 7260 KB Output is correct
3 Correct 1 ms 7260 KB Output is correct
4 Correct 2 ms 7260 KB Output is correct
5 Correct 1 ms 7260 KB Output is correct
6 Correct 1 ms 7492 KB Output is correct
7 Correct 2 ms 7272 KB Output is correct
8 Correct 2 ms 7260 KB Output is correct
9 Correct 2 ms 7260 KB Output is correct
10 Correct 2 ms 7260 KB Output is correct
11 Correct 2 ms 7260 KB Output is correct
12 Correct 2 ms 7260 KB Output is correct
13 Correct 1 ms 7260 KB Output is correct
14 Correct 1 ms 7260 KB Output is correct
15 Correct 2 ms 7260 KB Output is correct
16 Correct 1 ms 7488 KB Output is correct
17 Correct 1 ms 7260 KB Output is correct
18 Correct 1 ms 7260 KB Output is correct
19 Correct 1 ms 7260 KB Output is correct
20 Correct 2 ms 7260 KB Output is correct
21 Correct 2 ms 7260 KB Output is correct
22 Correct 1 ms 7260 KB Output is correct
23 Correct 2 ms 7260 KB Output is correct
24 Correct 2 ms 7260 KB Output is correct
25 Correct 2 ms 7260 KB Output is correct
26 Correct 2 ms 7500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 7256 KB Output is correct
2 Correct 1 ms 7260 KB Output is correct
3 Correct 1 ms 7260 KB Output is correct
4 Correct 2 ms 7260 KB Output is correct
5 Correct 1 ms 7260 KB Output is correct
6 Correct 1 ms 7492 KB Output is correct
7 Correct 2 ms 7272 KB Output is correct
8 Correct 2 ms 7260 KB Output is correct
9 Correct 2 ms 7260 KB Output is correct
10 Correct 2 ms 7260 KB Output is correct
11 Correct 2 ms 7260 KB Output is correct
12 Correct 2 ms 7260 KB Output is correct
13 Correct 1 ms 7260 KB Output is correct
14 Correct 1 ms 7260 KB Output is correct
15 Correct 2 ms 7260 KB Output is correct
16 Correct 1 ms 7488 KB Output is correct
17 Correct 1 ms 7260 KB Output is correct
18 Correct 1 ms 7260 KB Output is correct
19 Correct 1 ms 7260 KB Output is correct
20 Correct 2 ms 7260 KB Output is correct
21 Correct 2 ms 7260 KB Output is correct
22 Correct 1 ms 7260 KB Output is correct
23 Correct 2 ms 7260 KB Output is correct
24 Correct 2 ms 7260 KB Output is correct
25 Correct 2 ms 7260 KB Output is correct
26 Correct 2 ms 7500 KB Output is correct
27 Correct 51 ms 7732 KB Output is correct
28 Correct 46 ms 7516 KB Output is correct
29 Correct 41 ms 7744 KB Output is correct
30 Correct 40 ms 7516 KB Output is correct
31 Correct 3 ms 7524 KB Output is correct
32 Correct 2 ms 7516 KB Output is correct
33 Correct 2 ms 7768 KB Output is correct
34 Correct 10 ms 7516 KB Output is correct
35 Correct 14 ms 7580 KB Output is correct
36 Correct 60 ms 7516 KB Output is correct
37 Correct 37 ms 7516 KB Output is correct
38 Correct 70 ms 7680 KB Output is correct
39 Correct 65 ms 7516 KB Output is correct
40 Correct 5 ms 7516 KB Output is correct
41 Correct 25 ms 7680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 7256 KB Output is correct
2 Correct 1 ms 7260 KB Output is correct
3 Correct 1 ms 7260 KB Output is correct
4 Correct 2 ms 7260 KB Output is correct
5 Correct 1 ms 7260 KB Output is correct
6 Correct 1 ms 7492 KB Output is correct
7 Correct 2 ms 7272 KB Output is correct
8 Correct 2 ms 7260 KB Output is correct
9 Correct 2 ms 7260 KB Output is correct
10 Execution timed out 3022 ms 32812 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 7256 KB Output is correct
2 Correct 1 ms 7260 KB Output is correct
3 Correct 1 ms 7260 KB Output is correct
4 Correct 2 ms 7260 KB Output is correct
5 Correct 1 ms 7260 KB Output is correct
6 Correct 1 ms 7492 KB Output is correct
7 Correct 2 ms 7272 KB Output is correct
8 Correct 2 ms 7260 KB Output is correct
9 Correct 2 ms 7260 KB Output is correct
10 Correct 2 ms 7260 KB Output is correct
11 Correct 2 ms 7260 KB Output is correct
12 Correct 2 ms 7260 KB Output is correct
13 Correct 1 ms 7260 KB Output is correct
14 Correct 1 ms 7260 KB Output is correct
15 Correct 2 ms 7260 KB Output is correct
16 Correct 1 ms 7488 KB Output is correct
17 Correct 1 ms 7260 KB Output is correct
18 Correct 1 ms 7260 KB Output is correct
19 Correct 1 ms 7260 KB Output is correct
20 Correct 2 ms 7260 KB Output is correct
21 Correct 2 ms 7260 KB Output is correct
22 Correct 1 ms 7260 KB Output is correct
23 Correct 2 ms 7260 KB Output is correct
24 Correct 2 ms 7260 KB Output is correct
25 Correct 2 ms 7260 KB Output is correct
26 Correct 2 ms 7500 KB Output is correct
27 Correct 51 ms 7732 KB Output is correct
28 Correct 46 ms 7516 KB Output is correct
29 Correct 41 ms 7744 KB Output is correct
30 Correct 40 ms 7516 KB Output is correct
31 Correct 3 ms 7524 KB Output is correct
32 Correct 2 ms 7516 KB Output is correct
33 Correct 2 ms 7768 KB Output is correct
34 Correct 10 ms 7516 KB Output is correct
35 Correct 14 ms 7580 KB Output is correct
36 Correct 60 ms 7516 KB Output is correct
37 Correct 37 ms 7516 KB Output is correct
38 Correct 70 ms 7680 KB Output is correct
39 Correct 65 ms 7516 KB Output is correct
40 Correct 5 ms 7516 KB Output is correct
41 Correct 25 ms 7680 KB Output is correct
42 Execution timed out 3022 ms 32812 KB Time limit exceeded
43 Halted 0 ms 0 KB -