제출 #1005179

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
10051792024-06-22 08:30:39Mardonbekhazratov경주 (Race) (IOI11_race)C++17
21 / 100
3052 ms11516 KiB
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include "race.h"
#include<vector>
#include<queue>
#include<array>
using namespace std;
int n,k,ans;
vector<vector<pair<int,int>>>v;
void dfs(int x,int p,long long dis,int cnt){
if(dis>=k){
if(dis==k) ans=min(ans,cnt);
return;
}
for(auto [z,w]:v[x]){
if(z!=p) dfs(z,x,dis+w,cnt+1);
}
}
void solve(int x){
queue<array<int,4>>q;
q.push({x,x,0,0});
while(!q.empty()){
auto [x,p,dis,cnt]=q.front();
q.pop();
if(dis==k){
ans=min(ans,cnt);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...