Submission #550960

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
5509602022-04-19 13:25:33ac2huRace (IOI11_race)C++14
100 / 100
1074 ms65956 KiB
#include<bits/stdc++.h>
using namespace std;
#include "race.h"
// Do everything in global distance because it simplifies work
const int MX = 2e5 + 10;
int ans = 1e9, n, k, timer = 0, d[MX], tin[MX], tout[MX], st[MX], big[MX], siz[MX], edges[MX];
vector<pair<int,int>> adj[MX];
map<int,int> hold;
void dfs2(int i,int p,bool keep){
for(auto [e, w] : adj[i]){
if(e != p && e != big[i]) dfs2(e, i,false);
}
if(big[i] != -1)
dfs2(big[i], i, true);
hold[d[i]] = edges[i];
int total = k + 2*d[i];
if(hold.find(total - d[i]) != hold.end()){
ans = min(ans, hold[total - d[i]] - edges[i]);
}
for(auto [e, w] : adj[i]){
if(e != p && e != big[i]){
for(int tim = tin[e];tim<=tout[e];tim++){
int id = st[tim];
if(hold.find(total - d[id]) != hold.end()){
ans = min(ans, hold[total - d[id]] + edges[id] - 2*edges[i]);
}
}
for(int tim = tin[e];tim<=tout[e];tim++){
int id = st[tim];
hold[d[id]] = min(hold[d[id]], edges[id]);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

race.cpp: In function 'void dfs2(int, int, bool)':
race.cpp:10:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   10 |     for(auto [e, w] : adj[i]){
      |              ^
race.cpp:20:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   20 |     for(auto [e, w] : adj[i]){
      |              ^
race.cpp:36:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   36 |         for(auto [e,w] : adj[i]){
      |                  ^
race.cpp: In function 'void dfs1(int, int)':
race.cpp:53:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   53 |     for(auto [e, w] : adj[i]){
      |              ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...