Submission #238448

# Submission time Handle Problem Language Result Execution time Memory
238448 2020-06-11T11:18:05 Z vankata Birmingham (COCI20_birmingham) C++14
20 / 70
300 ms 11888 KB
#include<bits/stdc++.h>
using namespace std;
const int  MAXN = (int )(1<<17);
vector<long long >v[MAXN];
vector <long long > rig;
long long  n,m,q,k,used[MAXN];
void BFS()
{
    long long  i,j;
    queue<long long >q;
    for(auto nb:rig)
    {
        used[nb]=true;
        q.push(nb);
    }
    while(!q.empty())
    {
        i=q.front();
        q.pop();
        for(auto nb:v[i])
        {
            if(!used[nb])
            {
                used[nb]=used[i]+1;
                q.push(nb);
            }
        }
    }
}
void read()
{
    long long  i,j,x,y;
    cin>>n>>m>>q>>k;
    for(i=0;i<q;i++)
    {
        cin>>x;
        rig.push_back(x);
    }
    for(i=0;i<m;i++)
    {
        cin>>x>>y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
}
void solve()
{
    long long  i,ans=0;
    for(i=1;i<=n;i++)
    {
        used[i]--;
        ans = ceil((-1+sqrt(1+4*used[i]*2/k))/2);
        cout<<ans<<" ";
    }cout<<endl;
}
int main()
{
    read();
    BFS();
    solve();
    return 0;
}

Compilation message

birmingham.cpp: In function 'void BFS()':
birmingham.cpp:9:18: warning: unused variable 'j' [-Wunused-variable]
     long long  i,j;
                  ^
birmingham.cpp: In function 'void read()':
birmingham.cpp:32:18: warning: unused variable 'j' [-Wunused-variable]
     long long  i,j,x,y;
                  ^
# Verdict Execution time Memory Grader output
1 Correct 7 ms 3456 KB Output is correct
2 Correct 8 ms 3456 KB Output is correct
3 Correct 7 ms 3456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 3456 KB Output is correct
2 Correct 7 ms 3456 KB Output is correct
3 Correct 7 ms 3456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 3456 KB Output is correct
2 Correct 7 ms 3456 KB Output is correct
3 Correct 7 ms 3456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 3456 KB Output is correct
2 Correct 7 ms 3456 KB Output is correct
3 Correct 7 ms 3456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 3456 KB Output is correct
2 Correct 8 ms 3456 KB Output is correct
3 Incorrect 7 ms 3456 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 3456 KB Output is correct
2 Correct 8 ms 3456 KB Output is correct
3 Incorrect 7 ms 3456 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 3584 KB Output is correct
2 Correct 7 ms 3456 KB Output is correct
3 Incorrect 7 ms 3456 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 259 ms 10684 KB Output is correct
2 Correct 287 ms 11180 KB Output is correct
3 Correct 289 ms 11840 KB Output is correct
4 Correct 227 ms 10220 KB Output is correct
5 Incorrect 229 ms 10456 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 267 ms 11052 KB Output is correct
2 Correct 261 ms 11052 KB Output is correct
3 Correct 276 ms 11392 KB Output is correct
4 Correct 300 ms 11384 KB Output is correct
5 Incorrect 268 ms 11188 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 247 ms 10812 KB Output is correct
2 Correct 274 ms 11300 KB Output is correct
3 Correct 288 ms 11888 KB Output is correct
4 Correct 262 ms 11300 KB Output is correct
5 Incorrect 232 ms 10700 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 234 ms 10268 KB Output is correct
2 Correct 257 ms 11000 KB Output is correct
3 Correct 289 ms 11648 KB Output is correct
4 Correct 245 ms 10744 KB Output is correct
5 Incorrect 224 ms 10360 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 236 ms 10360 KB Output is correct
2 Correct 256 ms 10616 KB Output is correct
3 Correct 248 ms 10868 KB Output is correct
4 Correct 242 ms 10700 KB Output is correct
5 Incorrect 244 ms 10744 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 235 ms 10456 KB Output is correct
2 Correct 248 ms 10812 KB Output is correct
3 Correct 242 ms 11116 KB Output is correct
4 Correct 261 ms 11036 KB Output is correct
5 Incorrect 242 ms 10488 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 248 ms 10572 KB Output is correct
2 Correct 237 ms 10232 KB Output is correct
3 Correct 284 ms 11760 KB Output is correct
4 Correct 240 ms 10704 KB Output is correct
5 Incorrect 251 ms 10872 KB Output isn't correct
6 Halted 0 ms 0 KB -