Orange Boy Can You Solve It Out? Ep. 53 - Gaokao Special 2

思考题 which is an adaptation from a popular problem.

The source problem is very popular. IDK if this adaptation has been made or not.

Adaptation

There are N people indexed from 1 to N in a room. Each of them is given a hat of a random color. The total number of possible colors is M and the colors are indexed from 1 to M. A person cannot see his own hat but can see the colors of the hats of the other N-1 people.

Now, starting from person 1, each person need to guess the color of his own hat. We call it a "win" iff all people guessed their colors correctly.

The color a person guesser will guess is the return value of the following method:

int guessColor(int n,int m, int guesser, vector<int> otherHatColors)

Please note that:
- Person 1 guesses then person 2 guesses then person 3... The order cannot be changed or swapped.
- The game ends whenever a guesser returns a wrong guess.
- Communication between people are prohibited as can be shown in the method signature.
- otherHatColors[i] is the color of the hat of person i. otherHatColors[guesser]=-1 always holds.

Implement this function. Your solution will be run on multiple testcases and your score S will be defined as: S=someScoringFunction(\frac{winCount}{totalCount})

版权声明:
作者:XGN
链接:https://blog.hellholestudios.top/archives/921
来源:Hell Hole Studios Blog
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>
文章目录
关闭
目 录