Skip to content

Instantly share code, notes, and snippets.

@yosupo06
Last active October 30, 2015 02:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yosupo06/a977cdeec184437af0e4 to your computer and use it in GitHub Desktop.
Save yosupo06/a977cdeec184437af0e4 to your computer and use it in GitHub Desktop.
int main() {
Tree tr = new Tree(); //trは1ノード
srand(time(NULL)); //このブロックは乱数を適当に消費するためにあります
int rn = rand();
for (int i = 0; i < rn; i++) {
int sz = tr.size();
tr = merge(tr, tr);
tr = split(tr, sz).first; //同じものをくっつけて分離するだけの意味のない動作
}
assert(tr.size() == 1);
//ここから本題
for (int i = 0; i < 100000; i++) {
int sz = tr.size();
tr = merge(tr, tr);
tr = split(tr, sz+1).first; //trのsizeは1個ずつ大きくなっていくはず
}
//ここでtrはバランスが崩れまくっている(ことがある)はず
printf("%d\n", tr.max_dps());
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment