Submission #911085

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9110852024-01-18 12:38:10VMaksimoski008Valley (BOI19_valley)C++14
100 / 100
386 ms38688 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int LOG = 20, maxn = 1e5 + 5;
int n, s, q, e, timer = 0;
vector<vector<pii> > graph;
int store[maxn+1], in[maxn+1], out[maxn+1], depth[maxn+1], up[maxn+1][LOG];
ll dp[maxn+1], dist[maxn+1], mn[maxn+1][LOG];
void dfs(int u, int p) {
in[u] = timer++;
dp[u] = (store[u] ? dist[u] : 1e17);
for(auto &[v, w] : graph[u]) {
if(v == p) continue;
dist[v] = dist[u] + w;
dfs(v, u);
dp[u] = min(dp[u], dp[v]);
}
out[u] = timer;
}
void dfs2(int u, int p) {
for(int i=1; i<LOG; i++) {
up[u][i] = up[ up[u][i-1] ][i-1];
mn[u][i] = min(mn[u][i-1], mn[ up[u][i-1] ][i-1]);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

valley.cpp: In function 'void dfs(int, int)':
valley.cpp:17:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   17 |     for(auto &[v, w] : graph[u]) {
      |               ^
valley.cpp: In function 'void dfs2(int, int)':
valley.cpp:33:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   33 |     for(auto &[v, _] : graph[u]) {
      |               ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...