由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 问一道题的思路,bloomreach puzzle
相关主题
人极度郁闷的时候,应该怎么减轻压力?有谁拿过bloomreach的offer吗?
Re: 问大家一个感受,关于放弃以前学的 (转载)Goog和一中型公司和一小型公司的选择
JP Morgan, GS 这些大投行反应都这么慢吗?Bloomreach 怎么样
Amazon interview question.(4)感觉现在没什么好的startup啊
bloomreach 这个公司怎么样请问CTO面试一般会面什么啊?
msft or rocket fuel? 选哪个?我来说说bloomreach。。。
请教bloomreach二轮电面bloomreach vs uber offer求建议
郁闷的求职过程有人听过BloomResearch
相关话题的讨论汇总
话题: vineyards话题: wines话题: bloomreach话题: wine话题: 之间
进入JobHunting版参与讨论
1 (共1页)
m********c
发帖数: 105
1
我在看bloomreach的opening的时候,看到这个puzzle,题目是wine testing。下面是
描述,链接在这个http://bloomreach.com/puzzles/
A large group of friends from the town of Nocillis visit the vineyards of
Apan to taste wines. The vineyards produce many fine wines and the friends
decide to buy as many as 3 bottles of wine each if they are available to
purchase. Unfortunately, the vineyards of Apan have a peculiar restriction
that they can not sell more than one bottle of the same wine. So the
vineyards come up with the following scheme: They ask each person to write
down a list of up to 10 wines that they enjoyed and would be happy buying.
With this information, please help the vineyards maximize the number of
wines that they can sell to the group of friends.
简单点说就是有很多的朋友想买酒,但是每种酒最多只能卖一次,一个人最多可以买三
种酒。题目给了每个人想买的酒的id,每个人最多想买10种。根据这个信息,问酒庄如
何可以卖出最多的酒。
我昨天想了想,觉得这个题目类似set cover或者set packing problem。解法的话就是
用greedy。但是总觉得不太好,不知道大家有没有更好的思路。
k******4
发帖数: 94
2
Max fllow 算法?建立有向图。一边是人,一边是酒,人和酒之间加link,同时添加两
个辅助节点s d,s到每个人加link,每瓶酒到d之间加link,然后计算两个辅助节点s d
之间的max。flow
k******4
发帖数: 94
3
补充下, s到人之间link weight为3,其它为1。
m********c
发帖数: 105
4
max flow是个思路。但是我想了想,max flow里每一个edge有不同capacity,是要计算
在符合capacity的情况下最大的flow是多少。但是这个情况里,人和酒之间没有
capacity,而且是要计算能有多少酒卖出去,也就是能有多少flow经过酒的node。这也
和max flow不一样。

d

【在 k******4 的大作中提到】
: Max fllow 算法?建立有向图。一边是人,一边是酒,人和酒之间加link,同时添加两
: 个辅助节点s d,s到每个人加link,每瓶酒到d之间加link,然后计算两个辅助节点s d
: 之间的max。flow

k******4
发帖数: 94
5
人和酒的capacity为1?
m********c
发帖数: 105
6
不明白,我上wikipedia上看了看max flow,是从source到sink之间,所有node之间的
max flow。但是这个里面,人和人之间酒和酒之间不能有flow吧?

【在 k******4 的大作中提到】
: 人和酒的capacity为1?
k******4
发帖数: 94
7
我没说清楚,人和人之间还有酒和酒之间没有link,人和酒之间link的capacity为1,
酒和d之间也是1,但是s和人之间是3
l*n
发帖数: 529
8
这个办法好。

【在 k******4 的大作中提到】
: 我没说清楚,人和人之间还有酒和酒之间没有link,人和酒之间link的capacity为1,
: 酒和d之间也是1,但是s和人之间是3

b***e
发帖数: 1419
9
这个是典型的匈牙利算法。放狗搜一下就知道了。

【在 m********c 的大作中提到】
: 我在看bloomreach的opening的时候,看到这个puzzle,题目是wine testing。下面是
: 描述,链接在这个http://bloomreach.com/puzzles/
: A large group of friends from the town of Nocillis visit the vineyards of
: Apan to taste wines. The vineyards produce many fine wines and the friends
: decide to buy as many as 3 bottles of wine each if they are available to
: purchase. Unfortunately, the vineyards of Apan have a peculiar restriction
: that they can not sell more than one bottle of the same wine. So the
: vineyards come up with the following scheme: They ask each person to write
: down a list of up to 10 wines that they enjoyed and would be happy buying.
: With this information, please help the vineyards maximize the number of

s*****n
发帖数: 994
10
一共有多少种酒?

【在 m********c 的大作中提到】
: 我在看bloomreach的opening的时候,看到这个puzzle,题目是wine testing。下面是
: 描述,链接在这个http://bloomreach.com/puzzles/
: A large group of friends from the town of Nocillis visit the vineyards of
: Apan to taste wines. The vineyards produce many fine wines and the friends
: decide to buy as many as 3 bottles of wine each if they are available to
: purchase. Unfortunately, the vineyards of Apan have a peculiar restriction
: that they can not sell more than one bottle of the same wine. So the
: vineyards come up with the following scheme: They ask each person to write
: down a list of up to 10 wines that they enjoyed and would be happy buying.
: With this information, please help the vineyards maximize the number of

k******4
发帖数: 94
11
找最大匹配的话,还要剔除那些有人买了大于三瓶酒的情况。

【在 b***e 的大作中提到】
: 这个是典型的匈牙利算法。放狗搜一下就知道了。
m********c
发帖数: 105
12
嗯,我试试

【在 k******4 的大作中提到】
: 我没说清楚,人和人之间还有酒和酒之间没有link,人和酒之间link的capacity为1,
: 酒和d之间也是1,但是s和人之间是3

b***e
发帖数: 1419
13
每个人3个点就行了。

【在 k******4 的大作中提到】
: 找最大匹配的话,还要剔除那些有人买了大于三瓶酒的情况。
k******4
发帖数: 94
14
说的对,我想错了。

每个人3个点就行了。

【在 b***e 的大作中提到】
: 每个人3个点就行了。
1 (共1页)
进入JobHunting版参与讨论
相关主题
有人听过BloomResearchbloomreach 这个公司怎么样
小女子跪求bloomreach intern面试经验msft or rocket fuel? 选哪个?
大家帮我看看, 我为什么又挂了?请教bloomreach二轮电面
facebook 一面郁闷的求职过程
人极度郁闷的时候,应该怎么减轻压力?有谁拿过bloomreach的offer吗?
Re: 问大家一个感受,关于放弃以前学的 (转载)Goog和一中型公司和一小型公司的选择
JP Morgan, GS 这些大投行反应都这么慢吗?Bloomreach 怎么样
Amazon interview question.(4)感觉现在没什么好的startup啊
相关话题的讨论汇总
话题: vineyards话题: wines话题: bloomreach话题: wine话题: 之间