Submission #1005524

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10055242024-06-22 14:49:10ilefRace (IOI11_race)C++14
100 / 100
222 ms34388 KiB
#include <bits/stdc++.h>
using namespace std;
#define MAXN 200005
//const int MAX_N=2e5+14;
#define KK 1000001
int n,k;
int ans;
int mx_depth;
int cnt[KK];
bool removed[MAXN];
int subtree[MAXN];
vector<pair<int,int>>graph[MAXN];
int treesize(int node,int parent){
subtree[node]=1;
for(auto [w,child]:graph[node]){
if(child!=parent && !removed[child]){
subtree[node]+=treesize(child,node);
}
}
return subtree[node];
}
int findcentroid(int node,int parent,int treesz){
int sz=treesz/2;
for(auto[w,child]:graph[node]){
if(child!=parent && !removed[child]&& subtree[child]>(sz)){
return findcentroid(child,node,treesz);
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

race.cpp: In function 'int treesize(int, int)':
race.cpp:15:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   15 |     for(auto [w,child]:graph[node]){
      |              ^
race.cpp: In function 'int findcentroid(int, int, int)':
race.cpp:26:13: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   26 |     for(auto[w,child]:graph[node]){
      |             ^
race.cpp: In function 'void getans(int, int, int, int, bool)':
race.cpp:52:13: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   52 |     for(auto[w,child]:graph[node]){
      |             ^
race.cpp: In function 'void del(int, int, int)':
race.cpp:61:13: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   61 |     for(auto[w,child]:graph[node]){
      |             ^
race.cpp: In function 'void centroid_decomp(int, int)':
race.cpp:72:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   72 |     for(auto &[w,child]:graph[centroid]){
      |               ^
race.cpp:80:13: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   80 |     for(auto[w,i]:graph[centroid]){
      |             ^
race.cpp:85:13: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   85 |     for(auto[w,i]:graph[centroid]){
      |             ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...