# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
942780 | Darren0724 | The Xana coup (BOI21_xanadu) | C++17 | 68 ms | 33896 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define LCBorz ios_base::sync_with_stdio(false); cin.tie(0);
#define int long long
#define all(x) x.begin(), x.end()
#define endl '\n'
const int N=200005;
const int INF=1e9;
vector<int> adj[N];
vector dp(4,vector<int>(N,INF));
vector v(N,0);
void dfs(int k,int pa){
vector<int> dp0,dp1;
int t0=0,t1=0;
for(int j:adj[k]){
if(j==pa)continue;
dfs(j,k);
t0+=dp[0][j];
dp0.push_back({dp[1][j]-dp[0][j]});
t1+=dp[2][j];
dp1.push_back({dp[3][j]-dp[2][j]});
}
sort(all(dp0));
sort(all(dp1));
int now=v[k]*2;
dp[now][k]=min(dp[now][k],t0);
for(int j:dp0){
now^=2;
t0+=j;
dp[now][k]=min(dp[now][k],t0);
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |