# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
543062 | amunduzbaev | Fireworks (APIO16_fireworks) | C++17 | 26 ms | 1144 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "bits/stdc++.h"
using namespace std;
#define ar array
#define int long long
const int N = 305;
const int inf = 1e18;
vector<ar<int, 2>> edges[N];
int dp[N][N];
void dfs(int u){
for(auto x : edges[u]){
dfs(x[0]);
for(int j=0;j<N;j++){
int pre = dp[u][j]; dp[u][j] = inf;
for(int l=0;l<=j;l++){
dp[u][j] = min(dp[u][j], pre + dp[x[0]][l] + abs(j - l - x[1]));
}
}
}
if(edges[u].empty()){
memset(dp[u], 63, sizeof dp[u]);
dp[u][0] = 0;
}
}
signed main(){
ios::sync_with_stdio(0); cin.tie(0);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |