Submission #845389

#TimeUsernameProblemLanguageResultExecution timeMemory
845389vjudge1Birmingham (COCI20_birmingham)C++98
70 / 70
500 ms11216 KiB
#include<bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); long long a,b,c,d,e,f,gun,ay,yil,es,p; vector < vector <long long> > adj; queue <long long> que; vector <long long> ana; long long uza[100005]; memset(uza,-1,sizeof(uza)); cin>>a>>b>>c>>d; for(long long i=0;a>=i;i++){ adj.push_back(ana); } for(long long i=0;c>i;i++){ cin>>f; ana.push_back(f); } for(long long i=0;b>i;i++){ cin>>f>>p; adj[f].push_back(p); adj[p].push_back(f); } for(long long i=0;c>i;i++){ long long pivot = ana[i]; int vis[100005]; memset(vis,0,sizeof(vis)); uza[pivot] = 0; que.push(pivot); while(que.size()){ pivot = que.front(); que.pop(); if(vis[pivot] == 0){ vis[pivot] = 1; for(long long j=0;adj[pivot].size()>j;j++){ if(uza[adj[pivot][j]] == -1){ uza[adj[pivot][j]] = uza[pivot] + 1; if(vis[adj[pivot][j]] == 0) que.push(adj[pivot][j]); } else{ if(uza[adj[pivot][j]] > uza[pivot] + 1){ uza[adj[pivot][j]] = uza[pivot] + 1; if(vis[adj[pivot][j]] == 0) que.push(adj[pivot][j]); } } } } } } for(long long i=1;a>=i;i++){ long long pork=1; //cout<<uza[i]<<" "; if(uza[i] == 0){ cout<<0<<" "; } else{ long long h=(pork * (pork+1)); h/=2; h*=d; while(h < uza[i]){ pork++; h=(pork * (pork+1)); h/=2; h*=d; } cout<<pork<<" "; } } }

Compilation message (stderr)

birmingham.cpp: In function 'int main()':
birmingham.cpp:36:39: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   36 |    for(long long j=0;adj[pivot].size()>j;j++){
      |                      ~~~~~~~~~~~~~~~~~^~
birmingham.cpp:6:20: warning: unused variable 'e' [-Wunused-variable]
    6 |  long long a,b,c,d,e,f,gun,ay,yil,es,p;
      |                    ^
birmingham.cpp:6:24: warning: unused variable 'gun' [-Wunused-variable]
    6 |  long long a,b,c,d,e,f,gun,ay,yil,es,p;
      |                        ^~~
birmingham.cpp:6:28: warning: unused variable 'ay' [-Wunused-variable]
    6 |  long long a,b,c,d,e,f,gun,ay,yil,es,p;
      |                            ^~
birmingham.cpp:6:31: warning: unused variable 'yil' [-Wunused-variable]
    6 |  long long a,b,c,d,e,f,gun,ay,yil,es,p;
      |                               ^~~
birmingham.cpp:6:35: warning: unused variable 'es' [-Wunused-variable]
    6 |  long long a,b,c,d,e,f,gun,ay,yil,es,p;
      |                                   ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...