Submission #282028

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
2820282020-08-23 20:08:15JoMeeRailway (BOI17_railway)C++17
7 / 100
1093 ms79524 KiB
#include <bits/stdc++.h>
#define int long long
using namespace std;
#define rep(i,a,n) for(int i = a; i<n; i++)
#define per(i,a,n) for(int i = n-1; i>=a; i--)
int max(int a,int b){return (a>b)?a:b;}
int min(int a,int b){return (a<b)?a:b;}
vector<int> adj[100005];
int par[20][100005], szs[100005], depth[100005];
set<int> start[100005];
set<int> out[100005];
pair<int,int> edges[100005];
void dfs(int e,int p){
par[0][e] = p;
depth[e] = depth[p]+1;
for(int j:adj[e]){
if(j != p)dfs(j,e);
}
}
set<int>* smldfs(int i,int p){
set<int>* ret = new set<int>(start[i].begin(),start[i].end());
for(auto e:adj[i]){
if(e != p){
set<int>* v = smldfs(e,i);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

railway.cpp: In function 'long long int lca(long long int, long long int)':
railway.cpp:57:5: warning: iteration 9223372036854775787 invokes undefined behavior [-Waggressive-loop-optimizations]
   57 |     for(int i = 20; i >= 0; i++){
      |     ^~~
railway.cpp:57:23: note: within this loop
   57 |     for(int i = 20; i >= 0; 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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...