Submission #666165

# Submission time Handle Problem Language Result Execution time Memory
666165 2022-11-27T16:39:20 Z bin9638 007 (CEOI14_007) C++17
0 / 100
226 ms 19916 KB
#include<bits/stdc++.h>

using namespace std;
#define N 200010
#define ll long long
#define ii pair<int,int>
#define fs first
#define sc second
#define pb push_back

int dp[N][5],f[5],n,m;
vector<int>g[N];
deque<int>dq;

void build(int id)
{
    dp[f[id]][id]=0;
    dq.pb(f[id]);
    while(!dq.empty())
    {
        int u=dq.front();
        dq.pop_front();
        for(auto v:g[u])
            if(dp[v][id]>dp[u][id]+1)
            {
                dp[v][id]=dp[u][id]+1;
                dq.pb(v);
            }
    }
}

int main()
{
 //   freopen("A.inp","r",stdin);
  //  freopen("A.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n>>m>>f[1]>>f[2]>>f[3]>>f[4];
    for(int i=1;i<=m;i++)
    {
        int u,v;
        cin>>u>>v;
        g[u].pb(v);
        g[v].pb(u);
    }
    memset(dp,0x3f3f,sizeof(dp));
    for(int i=1;i<=2;i++)
        build(i);
    int val=min(dp[f[3]][2]-dp[f[3]][1],dp[f[4]][2]-dp[f[4]][1]);
   // if(val<0)
        cout<<-1;
      //      else cout<<val;
    return 0;
}

Compilation message

007.cpp: In function 'int main()':
007.cpp:50:9: warning: unused variable 'val' [-Wunused-variable]
   50 |     int val=min(dp[f[3]][2]-dp[f[3]][1],dp[f[4]][2]-dp[f[4]][1]);
      |         ^~~
# Verdict Execution time Memory Grader output
1 Partially correct 5 ms 8916 KB Partially correct
2 Incorrect 4 ms 8916 KB Output isn't correct
3 Partially correct 5 ms 8916 KB Partially correct
4 Partially correct 6 ms 8916 KB Partially correct
5 Partially correct 5 ms 8916 KB Partially correct
6 Incorrect 4 ms 8916 KB Output isn't correct
7 Incorrect 4 ms 8916 KB Output isn't correct
8 Partially correct 4 ms 8916 KB Partially correct
9 Incorrect 4 ms 8868 KB Output isn't correct
10 Incorrect 4 ms 8916 KB Output isn't correct
11 Incorrect 4 ms 8916 KB Output isn't correct
12 Incorrect 5 ms 8868 KB Output isn't correct
13 Incorrect 5 ms 8916 KB Output isn't correct
14 Incorrect 4 ms 8916 KB Output isn't correct
15 Incorrect 6 ms 8868 KB Output isn't correct
16 Incorrect 5 ms 8916 KB Output isn't correct
17 Incorrect 5 ms 8916 KB Output isn't correct
18 Incorrect 5 ms 8880 KB Output isn't correct
19 Incorrect 5 ms 8872 KB Output isn't correct
20 Incorrect 5 ms 8916 KB Output isn't correct
21 Incorrect 6 ms 8916 KB Output isn't correct
22 Incorrect 4 ms 8916 KB Output isn't correct
23 Incorrect 6 ms 8876 KB Output isn't correct
24 Partially correct 5 ms 8916 KB Partially correct
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 10572 KB Output isn't correct
2 Incorrect 33 ms 11448 KB Output isn't correct
3 Incorrect 22 ms 10684 KB Output isn't correct
4 Incorrect 35 ms 11448 KB Output isn't correct
5 Incorrect 22 ms 10544 KB Output isn't correct
6 Incorrect 22 ms 10836 KB Output isn't correct
7 Incorrect 26 ms 11052 KB Output isn't correct
8 Incorrect 26 ms 10928 KB Output isn't correct
9 Incorrect 43 ms 11864 KB Output isn't correct
10 Incorrect 120 ms 16220 KB Output isn't correct
11 Incorrect 55 ms 12748 KB Output isn't correct
12 Incorrect 66 ms 13628 KB Output isn't correct
13 Incorrect 62 ms 13128 KB Output isn't correct
14 Correct 47 ms 12364 KB Output is correct
15 Incorrect 54 ms 13664 KB Output isn't correct
16 Incorrect 58 ms 13888 KB Output isn't correct
17 Incorrect 61 ms 13468 KB Output isn't correct
18 Incorrect 69 ms 13488 KB Output isn't correct
19 Incorrect 88 ms 14636 KB Output isn't correct
20 Incorrect 167 ms 17380 KB Output isn't correct
21 Incorrect 87 ms 15004 KB Output isn't correct
22 Incorrect 88 ms 14396 KB Output isn't correct
23 Incorrect 87 ms 15012 KB Output isn't correct
24 Incorrect 82 ms 14972 KB Output isn't correct
25 Incorrect 83 ms 14720 KB Output isn't correct
26 Incorrect 69 ms 14368 KB Output isn't correct
27 Incorrect 85 ms 15088 KB Output isn't correct
28 Incorrect 93 ms 15044 KB Output isn't correct
29 Incorrect 118 ms 15900 KB Output isn't correct
30 Incorrect 161 ms 17868 KB Output isn't correct
31 Incorrect 105 ms 15796 KB Output isn't correct
32 Incorrect 92 ms 15028 KB Output isn't correct
33 Incorrect 103 ms 15164 KB Output isn't correct
34 Incorrect 97 ms 15396 KB Output isn't correct
35 Incorrect 76 ms 15208 KB Output isn't correct
36 Incorrect 89 ms 15332 KB Output isn't correct
37 Incorrect 110 ms 16156 KB Output isn't correct
38 Incorrect 119 ms 16024 KB Output isn't correct
39 Incorrect 124 ms 16040 KB Output isn't correct
40 Incorrect 176 ms 17708 KB Output isn't correct
41 Incorrect 226 ms 19916 KB Output isn't correct