Submission #798234

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
7982342023-07-30 13:57:05alittlemiddleRace (IOI11_race)C++14
100 / 100
670 ms49564 KiB
#include <bits/stdc++.h>
#include "race.h"
using namespace std;
const int MX = 1e6;
vector<vector<pair<int,int>>> g;
vector<int> sz, dead;
int dfs_sz(int v, int p){
sz[v] = 1;
for(auto [u, w]: g[v]) if(u != p && !dead[u]){
sz[v] += dfs_sz(u, v);
}
return sz[v];
}
int cent(int v, int p, int n){
for(auto [u, w]: g[v]) if(u != p && !dead[u] && sz[u] > n / 2){
return cent(u, v, n);
}
return v;
}
void dfs(int v, int p, int ws, vector<pair<int,int>> &ps, int ln){
if(ws > MX) return;
ps.emplace_back(ws, ln);
for(auto [u, w]: g[v]) if(u != p && !dead[u]){
dfs(u, v, ws + w, ps, ln + 1);
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

race.cpp: In function 'int dfs_sz(int, int)':
race.cpp:10:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   10 |     for(auto [u, w]: g[v]) if(u != p && !dead[u]){
      |              ^
race.cpp: In function 'int cent(int, int, int)':
race.cpp:17:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   17 |     for(auto [u, w]: g[v]) if(u != p && !dead[u] && sz[u] > n / 2){
      |              ^
race.cpp: In function 'void dfs(int, int, int, std::vector<std::pair<int, int> >&, int)':
race.cpp:26:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   26 |     for(auto [u, w]: g[v]) if(u != p && !dead[u]){
      |              ^
race.cpp: In function 'int dc(int, int)':
race.cpp:36:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   36 |     for(auto [u, w]: g[c]) if(!dead[u]){
      |              ^
race.cpp:44:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   44 |         for(auto [x, ln]: chld){
      |                  ^
race.cpp:49:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   49 |         for(auto [x, ln]: chld){
      |                  ^
race.cpp:54:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   54 |     for(auto [u, w]: g[c]) if(!dead[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...