제출 #1047823

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
10478232024-08-07 16:18:39Marco_Escandon도로 폐쇄 (APIO21_roads)C++11
0 / 100
2092 ms27528 KiB
//#include "roads.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define x first
#define y second
ll n;
vector<vector<pair<ll,ll>>> cad;
ll k;
vector<vector<ll>> cache;
ll sol(ll node,ll B, ll P)
{
if(B>k) return 1e14;
if(cache[node][B]!=-1) return cache[node][B];
vector<pair<ll,ll>> asd;
for(auto i:cad[node])
{
if(i.x==P) continue;
asd.push_back({sol(i.x,1,node),i.y+sol(i.x,0,node)});
}
if(asd.size()==0) return cache[node][B]=0;
vector<ll> dp(min((ll)asd.size()+1,k-B+1),1e14);
vector<ll> dp2=dp;
dp[0]=0;
for(int i=0; i<asd.size(); i++)
{
dp2.assign(dp.size(),1e14);
for(int j=dp.size()-1; j>-1; j--)
{
dp2[j]=dp[j]+asd[i].y;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

컴파일 시 표준 에러 (stderr) 메시지

roads.cpp: In function 'll sol(ll, ll, ll)':
roads.cpp:25:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     for(int i=0; i<asd.size(); i++)
      |                  ~^~~~~~~~~~~
roads.cpp:35:11: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |     if(k-B>=dp.size()) return cache[node][B]=dp.back();
      |        ~~~^~~~~~~~~~~
#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...