Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add permutation tree #745

Merged
merged 21 commits into from
Aug 11, 2022
Merged

Conversation

hotman78
Copy link
Contributor

@hotman78 hotman78 commented Jan 3, 2022

close #744

@hotman78
Copy link
Contributor Author

hotman78 commented Jan 3, 2022

現状問題文がかなり説明不足な気がします。
permutation treeが一般的な単語であれば省略しても問題ないのかなとは思ってます。
一般にpermutation treeといった場合条件を満たすノード数最小の木のみなのかもわかっていません。
取り敢えずジャッジではノード数最小の木のみをACとするのでいいと思ってます。

@hotman78
Copy link
Contributor Author

大分時間がたってしまいましたが、問題文を書きました。

@maspypy
Copy link
Collaborator

maspypy commented Jul 28, 2022

[問題文]
・定義語は太字とかにしてもよいかと
・区間の定義は不要?
・「他の connected interval に対してどちらかがもう一方を包含している、または交わらない物」
これもう少し読みやすくなりませんか。
(「~~に対して交わらない」みたいなのが主語述語みたいなのが合っていなく感じるせいかな。)

  • strong interval とは connected interval であって、他の connected interval に対して次のいずれかが成り立つものをいう。
    • どちらかがもう一方を包含している。
    • 交わらない。

とか

  • connected interval $I$ が strong interval であるとは、任意の connected interval $J$ に対して $I\subset J, J\subset I, I\cap J=\emptyset$ のいずれかが成り立つことをいう。

とか。

・順列 P のあとに余分なピリオド

[en]
・the The vertex

[問題名]
問題名も common interval decomposition tree に合わせる方が分かりやすいと思います

@hotman78
Copy link
Contributor Author

hotman78 commented Jul 30, 2022

ご指摘いただいた点直しました!
ありがとうございます!

@{lang.ja}
長さ $N$ の順列 $P_0, P_1, \cdots, P_{N-1}$ が与えられる。この順列に対応する **common interval decomposition tree** を出力せよ。ただし、本問において下記の様に語句を定義する。

- **interval** は ある整数 $l$,$r$ に対して、$\lbrace i\in \mathbb{Z}\ |\ 0 \leq l \leq i \leq r <N \rbrace $ と表せる集合とする。この様な **interval** を **interval** $\[l, r\]$ と表す。
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

空集合(例: l = 100, r = 0)がintervalなのかわかりにくい気がします(空集合はintervalではないですよね?)。

... ある整数 $l, r (0 &lt;= l &lt;= r &lt; N)$ に対して、...

とかでしょうか


- **interval** は ある整数 $l$,$r$ に対して、$\lbrace i\in \mathbb{Z}\ |\ 0 \leq l \leq i \leq r <N \rbrace $ と表せる集合とする。この様な **interval** を **interval** $\[l, r\]$ と表す。
- **connected interval** は **interval** $\[l, r\]$ であって $\lbrace P_i\ |\ l \leq i \leq r\rbrace$ もまた **interval** となるものである。
- **connected interval** $I$ が **strong interval** であるとは、任意の **connected interval** $J$ に対して $I \subset J$ , $J \subset I$ , $I \cap J =\emptyset$ のいずれかが成り立つことをいう。
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

重箱の隅ですが、他の行が "(新しい単語) は ... である" なのにこの行だけ違って少しアレなんで、

strong interval とは、connected interval $I$ のうち、...のいずれかが成り立つもののことをいう

はどうでしょう

$X$ is the number of vertices in the **common interval decomposition tree**. $\[l_i,r_i\]$ is the **interval** corresponding to the $i$-th vertex, and $S_i$ is "linear" if the $i$-th vertex is a **linear node** or "prime" if it is a **prime node**. However, the order of the vertices is the preoder of the children in ascending order of the left end $l$.

@{lang.ja}
$X$ は **common interval decomposition tree** の頂点数。$\[l_i,r_i\]$ は $i$ 番目の頂点に対応する **interval** とし、$S_i$ は $i$ 番目の頂点が **linear node** なら "linear" 、**prime node** なら "prime"。ただし、頂点の順番は子を左端 $l$ の昇順に並べた際の preoder。
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preorderを出力はなんか特殊な気がします

X
p l r S
p l r S
:
p l r S
p l r S

みたいな形式でノードの親(or = -1)を出力させるやつのほうがいい気がしますが どうでしょうか(custom checkerを用意する必要がありますが

for (int i = 0; i < N; ++i) {
if (i)
inf.readSpace();
int c = inf.readInt();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inf.readInt(0, N - 1)

@yosupo06
Copy link
Owner

yosupo06 commented Aug 7, 2022

ありがとうございます! いくつかコメントしましたが全体的に良さそうです 問題文も厳密になっていて、いい感じです

@yosupo06
Copy link
Owner

yosupo06 commented Aug 7, 2022

基本的にこのジャッジ半開区間なんですが、さすがにこの問題は閉区間のほうが自然な気がしていて、悩みどころ

@yosupo06 yosupo06 merged commit e6baec4 into yosupo06:master Aug 11, 2022
@hotman78
Copy link
Contributor Author

ごめんなさい、まだチェッカー作れてませんでした。今のままだとpreorderしかACにならない状態なので、可能なら戻して欲しいです。

@hotman78
Copy link
Contributor Author

@yosupo06

@hotman78
Copy link
Contributor Author

hotman78 commented Aug 11, 2022

提出も大した量出ないと思うので新規でissue立てて早めにプルリク送る形にしようと思います。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[問題案] Permutation Tree
3 participants