mirror of
https://gitcode.com/Zengtudor/alg2025.git
synced 2025-08-21 18:52:07 +00:00
update
This commit is contained in:
parent
93cdd285ff
commit
eeeb774996
59
src/8/15/P8817.cpp
Normal file
59
src/8/15/P8817.cpp
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
#include <cstdint>
|
||||||
|
#include <functional>
|
||||||
|
#include <iostream>
|
||||||
|
#include <queue>
|
||||||
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
using ll = int64_t;
|
||||||
|
ll n,m,k;
|
||||||
|
std::vector<ll> score;
|
||||||
|
std::vector<std::vector<ll>> edg;
|
||||||
|
std::vector<std::vector<bool>> cango;
|
||||||
|
std::vector<std::vector<ll>> best3;
|
||||||
|
|
||||||
|
void dfscango(ll from,ll cur, ll curk){
|
||||||
|
if(curk>k){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for(ll i=0;i<edg[cur].size();i++){
|
||||||
|
cango[from][edg[cur][i]]=true;
|
||||||
|
dfscango(from, edg[cur][i], curk+1);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
std::cin>>n>>m>>k;
|
||||||
|
score.resize(n+1);
|
||||||
|
edg.resize(n+1);
|
||||||
|
cango.resize(n+1,std::vector<bool>(n+1));
|
||||||
|
best3.resize(n+1);
|
||||||
|
for(ll i=2;i<=n;i++){
|
||||||
|
std::cin>>score[i];
|
||||||
|
}
|
||||||
|
for(ll i=1;i<=m;i++){
|
||||||
|
ll u,v;
|
||||||
|
std::cin>>u>>v;
|
||||||
|
edg[u].push_back(v);
|
||||||
|
edg[v].push_back(u);
|
||||||
|
}
|
||||||
|
for(ll i=1;i<=n;i++){
|
||||||
|
dfscango(i, i, 0);
|
||||||
|
}
|
||||||
|
for(ll i=2;i<=n;i++){
|
||||||
|
std::priority_queue<std::pair<ll, ll>,std::vector<std::pair<ll, ll>>,std::greater<>> pr;
|
||||||
|
for(ll j=2;j<=n;j++){
|
||||||
|
if(i==j)continue;
|
||||||
|
if(cango[i][j]&&cango[j][1]){
|
||||||
|
pr.emplace(score[j],j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//TODO
|
||||||
|
}
|
||||||
|
for(ll B=2;B<=n;B++){
|
||||||
|
for(ll C=B+1;C<=n;C++){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user