Submission #613902

# Submission time Handle Problem Language Result Execution time Memory
613902 2022-07-30T12:43:53 Z andrei_boaca 007 (CEOI14_007) C++14
0 / 100
231 ms 17556 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
int n,m,s,d,a,b;
vector<int> muchii[200005];
int dist[5][200005];
void bfs(int start,int index)
{
    for(int i=1;i<=n;i++)
        dist[index][i]=1e9;
    dist[index][start]=0;
    queue<int> coada;
    coada.push(start);
    while(!coada.empty())
    {
        int nod=coada.front();
        coada.pop();
        for(int i:muchii[nod])
            if(dist[index][i]>dist[index][nod]+1)
            {
                dist[index][i]=dist[index][nod]+1;
                coada.push(i);
            }
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>m>>s>>d>>a>>b;
    for(int i=1;i<=m;i++)
    {
        int x,y;
        cin>>x>>y;
        muchii[x].push_back(y);
        muchii[y].push_back(x);
    }
    bfs(a,1);
    bfs(b,2);
    bfs(d,3);
    bfs(s,4);
    int minim=1e9;
    for(int i=1;i<=n;i++)
    {
        bool good;
        if(dist[4][i]<=1)
            good=1;
        else
        {
            good=0;
            if(dist[1][i]>=dist[1][s])
            {
                if(dist[2][i]+1>=dist[2][s])
                    good=1;
            }
            if(dist[2][i]>=dist[2][s])
            {
                if(dist[1][i]+1>=dist[1][s])
                    good=1;
            }
        }
        if(!good)
            minim=min(minim,dist[3][i]-2);
    }
    cout<<0;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Incorrect 3 ms 4948 KB Output isn't correct
3 Correct 3 ms 4948 KB Output is correct
4 Correct 3 ms 4948 KB Output is correct
5 Correct 2 ms 4948 KB Output is correct
6 Incorrect 3 ms 4948 KB Output isn't correct
7 Incorrect 3 ms 4948 KB Output isn't correct
8 Correct 2 ms 4948 KB Output is correct
9 Incorrect 3 ms 4948 KB Output isn't correct
10 Incorrect 2 ms 4948 KB Output isn't correct
11 Partially correct 3 ms 4948 KB Partially correct
12 Incorrect 3 ms 5076 KB Output isn't correct
13 Incorrect 3 ms 5076 KB Output isn't correct
14 Incorrect 3 ms 4948 KB Output isn't correct
15 Incorrect 3 ms 4948 KB Output isn't correct
16 Incorrect 4 ms 5076 KB Output isn't correct
17 Incorrect 4 ms 5076 KB Output isn't correct
18 Incorrect 3 ms 5060 KB Output isn't correct
19 Incorrect 4 ms 5076 KB Output isn't correct
20 Incorrect 4 ms 5076 KB Output isn't correct
21 Incorrect 3 ms 5076 KB Output isn't correct
22 Incorrect 4 ms 5076 KB Output isn't correct
23 Incorrect 3 ms 5076 KB Output isn't correct
24 Correct 4 ms 5076 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 6956 KB Output isn't correct
2 Incorrect 27 ms 7744 KB Output isn't correct
3 Incorrect 24 ms 6996 KB Output isn't correct
4 Incorrect 26 ms 7892 KB Output isn't correct
5 Incorrect 20 ms 6844 KB Output isn't correct
6 Incorrect 24 ms 7080 KB Output isn't correct
7 Incorrect 25 ms 7280 KB Output isn't correct
8 Incorrect 24 ms 7252 KB Output isn't correct
9 Incorrect 42 ms 7712 KB Output isn't correct
10 Incorrect 113 ms 12108 KB Output isn't correct
11 Incorrect 49 ms 9292 KB Output isn't correct
12 Incorrect 63 ms 10356 KB Output isn't correct
13 Incorrect 75 ms 9532 KB Output isn't correct
14 Incorrect 40 ms 8828 KB Output isn't correct
15 Incorrect 68 ms 10384 KB Output isn't correct
16 Incorrect 63 ms 10660 KB Output isn't correct
17 Incorrect 62 ms 10160 KB Output isn't correct
18 Incorrect 59 ms 10096 KB Output isn't correct
19 Incorrect 83 ms 11340 KB Output isn't correct
20 Incorrect 168 ms 14188 KB Output isn't correct
21 Incorrect 93 ms 12596 KB Output isn't correct
22 Incorrect 91 ms 11524 KB Output isn't correct
23 Incorrect 91 ms 12372 KB Output isn't correct
24 Incorrect 81 ms 12272 KB Output isn't correct
25 Incorrect 91 ms 12116 KB Output isn't correct
26 Incorrect 90 ms 11540 KB Output isn't correct
27 Incorrect 106 ms 12532 KB Output isn't correct
28 Incorrect 98 ms 12564 KB Output isn't correct
29 Incorrect 125 ms 12984 KB Output isn't correct
30 Incorrect 170 ms 15020 KB Output isn't correct
31 Incorrect 127 ms 13696 KB Output isn't correct
32 Incorrect 112 ms 12356 KB Output isn't correct
33 Incorrect 92 ms 12744 KB Output isn't correct
34 Incorrect 108 ms 13064 KB Output isn't correct
35 Incorrect 93 ms 12744 KB Output isn't correct
36 Incorrect 93 ms 13072 KB Output isn't correct
37 Incorrect 165 ms 14072 KB Output isn't correct
38 Incorrect 126 ms 13948 KB Output isn't correct
39 Incorrect 140 ms 13888 KB Output isn't correct
40 Incorrect 208 ms 15548 KB Output isn't correct
41 Incorrect 231 ms 17556 KB Output isn't correct