Submission #981156

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9811562024-05-13 00:16:12Ivo_12구슬과 끈 (APIO14_beads)C++98
100 / 100
214 ms62436 KiB
#include <bits/stdc++.h>
#define FIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define pll pair < ll, ll >
using namespace std;
const int N = 2e5+10;
int n;
vector < pll > edges[N];
int deg[N];
int root;
ll dp[N][2][2]; //dp[x][y][z], x = node, y = (1 - able to connect) (0 - unable to connect), z = okomica nadena ili nije
vector < pll > spoji1[N];
vector < pll > spoji2[N];
vector < pll > spoji3[N];
ll sol = 0;
void dfs(int pos, int par) {
ll parval = -1e9, total = 0, dolje = -1e9, dvadolje = -1e9, doljesokomitim = -1e9, najveciokomiti = -1e9, dvadoljeijedanok = -1e9;
for(int i = 0; i < (int) edges[pos].size(); i++) {
if(edges[pos][i].f != par) {
dfs(edges[pos][i].f, pos);
total += dp[edges[pos][i].f][0][0];
spoji1[pos].pb(mp(dp[edges[pos][i].f][1][0] - dp[edges[pos][i].f][0][0] + edges[pos][i].s, edges[pos][i].f));
spoji2[pos].pb(mp(dp[edges[pos][i].f][0][1] - dp[edges[pos][i].f][0][0], edges[pos][i].f));
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
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...