Submission #1033794

# Submission time Handle Problem Language Result Execution time Memory
1033794 2024-07-25T06:25:53 Z vjudge1 Meetings 2 (JOI21_meetings2) C++17
0 / 100
1 ms 348 KB
#include<bits/stdc++.h>
#define int long long
#define ll pair<int,int>
using namespace std;

const int N=5005;
int danhdau[N][N];
int mask[N];
int kq[N];
int n,m;

void bfs(int u)
{
    for (int i=1;i<=n;i++) mask[i]=-1;
    mask[u]=0;
    queue<int> q;
    q.push(u);
    while (q.size())
    {
        int u=q.front();
        q.pop();
        for (int v=1;v<=n;v++)
        {
            if (danhdau[u][v]==1) continue;
            if (mask[v]!=-1) continue;
            mask[v]=mask[u]+1;
            q.push(v);
        }
    }
    for (int i=u+1;i<=n;i++)
    {
        if (mask[i]!=-1) kq[mask[i]]++;
    }
}

signed main()
{
    // freopen("kk.inp","r",stdin);
    // freopen("kk.out","w",stdout);
    //freopen("traffic.inp","r",stdin);
    //freopen("traffic.out","w",stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> n >> m;
    for (int i=1;i<=m;i++)
    {
        int u,v;
        cin >> u >> v;
        danhdau[u][v]=1;
        danhdau[v][u]=1;
    }
    for (int i=1;i<=n;i++)
    {
        bfs(i);
    }
    for (int i=1;i<n;i++) cout << kq[i] << " ";
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -