XMOJ-Script-dev / XMOJ-Script

XMOJ增强脚本
https://www.xmoj-bbs.me
GNU General Public License v3.0
4 stars 5 forks source link

[Feature Request] 讨论回复跳转优化 #43

Open langningchen opened 1 year ago

langningchen commented 1 year ago

检查项

描述

讨论回复提醒查看时应当直接跳转至相应的页面(如果是第二页的回复触发的提醒就跳转至第二页),而不是该讨论的第一页

原因

No response

PythonSmall-Q commented 1 year ago

errrrr好累

langningchen commented 1 year ago

@PythonSmall-Q 确实,我当时也很辛苦的

PythonSmall-Q commented 1 year ago

保持动力,客户至上

langningchen commented 1 year ago

当时我就是一个 Issue 没解决完又有一堆出来

boomzero commented 2 months ago

~保持动力~,客户至上

.

boomzero commented 2 months ago

Needs modifying the old db

langningchen commented 2 months ago

Needs modifying the old db

Why?

boomzero commented 2 months ago

Needs modifying the old db

Why?

@langningchen We only store postID

boomzero commented 2 months ago

Not replyID

langningchen commented 2 months ago

Emm...That seems bad. I forgot it.

PS: A have some problems about Competitive programming, may you help me?

boomzero commented 2 months ago

Emm...That seems bad. I forgot it.

PS: A have some problems about Competitive programming, may you help me?

What?

boomzero commented 2 months ago

In addition, we would appreciate it if you could check out https://github.com/XMOJ-Script-dev/XMOJ-Script/pull/599

langningchen commented 2 months ago

image image 我太菜了,不会做……

boomzero commented 2 months ago

image image 我太菜了,不会做……

Okay

boomzero commented 2 months ago

image image 我太菜了,不会做……

Okay

保留六位小数?...

boomzero commented 2 months ago

考虑状压dp...

langningchen commented 2 months ago

我想到 DP 了,但是还是不会…… 我太菜了

langningchen commented 2 months ago

还有刚才 #599 是怎么回事?我没太明白……

boomzero commented 2 months ago

还有刚才 #599 是怎么回事?我没太明白……

review it, please

boomzero commented 2 months ago

我想到 DP 了,但是还是不会…… 我太菜了

和这道题有点像?

夏川的生日就要到了。作为夏川形式上的男朋友,季堂打算给夏川买一些生日礼物。

商店里一共有 $N$ 种礼物。夏川每得到一种礼物,就会获得相应喜悦值 $W_i$(每种礼物的喜悦值不能重复获得)。 每次,店员会按照一定的概率 $P_i$(或者不拿出礼物),将第 $i$ 种礼物拿出来。季堂每次都会将店员拿出来的礼物买下来。没有拿出来视为什么都没有买到,也算一次购买。

众所周知,白毛切开都是黑的。所以季堂希望最后夏川的喜悦值尽可能地高。

求夏川最后最大的喜悦值是多少,并求出使夏川得到这个喜悦值,季堂的期望购买次数。

boomzero commented 2 months ago

提供题解(我也很菜...) 可以发现,喜悦值其实是没有什么用的。因为喜悦值不会是负的,所以最大喜悦值一定就是所有物品喜悦值之和。

现在问题转化成:$n$ 种物品,每次按一定概率拿一件物品,问拿齐所有种类物品的期望次数是多少。

算法一( $$10$$ 分):

这是一个送分点,耐心手玩一下也能发现规律,直接计算就好了。

算法二( $$30$$ 分):

观察到 $N$ 比较小,可以考虑状压 DP。设二进制状态 $S$ 表示当前有哪些物品已经拿了,然后就可以转移了。具体来说:

$$fS=\sum\limits{i \notin S} (f_{S+{i}} \cdot Pi) + (1-\sum\limits{i \notin S} P_i) \cdot f_S + 1$$

然后可以列出方程组,用高斯消元求解。

时间复杂度: $$O((2^N)^3)$$

算法三($100$ 分):

我们观察到,$S+{i}$与 $S$ 只差一个 $i$,所以不需要高斯消元。

移项可得,

$$\sum\limits_{i \notin S} P_i \cdot fS = \sum\limits{i \notin S} (f_{S+{i}} \cdot P_i) + 1$$。

问题解决。时间复杂度: $$O(2^N \cdot N)$$

langningchen commented 2 months ago

好的,我看看

boomzero commented 1 month ago

Emm...That seems bad. I forgot it.

PS: A have some problems about Competitive programming, may you help me?

@langningchen So, impossible?

Is there a way to MODIFY a d1 database?

boomzero commented 1 month ago

Emm...That seems bad. I forgot it. PS: A have some problems about Competitive programming, may you help me?

@langningchen So, impossible?

Is there a way to MODIFY a d1 database?

Apparently this works


ALTER TABLE table_name
ADD COLUMN column_name column_type;
langningchen commented 1 month ago

Emm...That seems bad. I forgot it. PS: A have some problems about Competitive programming, may you help me?

@langningchen So, impossible? Is there a way to MODIFY a d1 database?

Apparently this works

ALTER TABLE table_name
ADD COLUMN column_name column_type;

It works? It does not work on my machine. My way is to create a new temp database with the correct structure and copy the data into it, then drop to orginal database and rename it back.

boomzero commented 1 month ago

Emm...That seems bad. I forgot it. PS: A have some problems about Competitive programming, may you help me?

@langningchen So, impossible? Is there a way to MODIFY a d1 database?

Apparently this works

ALTER TABLE table_name
ADD COLUMN column_name column_type;

It works? It does not work on my machine. My way is to create a new temp database with the correct structure and copy the data into it, then drop to orginal database and rename it back.

According to ChatGPT

boomzero commented 1 month ago

Your way is… messy

boomzero commented 1 month ago

Let me test in production