Submission #1046534

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10465342024-08-06 16:17:45TurkhuuFactories (JOI14_factories)C++17
100 / 100
2281 ms196760 KiB
#include "factories.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int N;
vector<vector<pair<int, int>>> adj;
vector<vector<int>> s;
vector<int> dep, euler, pos, lg, sz, par, vis;
vector<ll> d2r, best;
void dfs(int x, int p) {
pos[x] = euler.size();
euler.push_back(x);
for (auto [y, z] : adj[x]) {
if (y == p) continue;
dep[y] = dep[x] + 1;
d2r[y] = d2r[x] + z;
dfs(y, x);
euler.push_back(x);
}
}
int f(int i, int j) {
return (i != -1 && (j == -1 || dep[i] < dep[j])) ? i : j;
}
void build() {
int n = euler.size();
s.resize(lg[n] + 1);
s[0] = euler;
for (int i = 0; i < lg[n]; i++) {
s[i + 1].resize(n - (2 << i) + 1);
for (int j = 0; j + (2 << i) <= n; j++) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

factories.cpp: In function 'int lca(int, int)':
factories.cpp:37:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   37 |     if (a > b) swap(a, b); b++;
      |     ^~
factories.cpp:37:28: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   37 |     if (a > b) swap(a, b); b++;
      |                            ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...