LoginSignup
1
1

More than 5 years have passed since last update.

Codeforces Beta Round #2

Last updated at Posted at 2013-12-20

はい。英語が全然わかりません。

A.Winner

・ざっくりと大意
なんかカードゲームのようですが理解不能。。。

・方針のようなもの
http://codeforces.com/blog/entry/109
1.First of all, we need to find the maximum score m at the end of the game. This can be done by emulating. After all rounds played just iterate over players and choose one with the maximum score.
まず第一に、我々は、ゲーム終了時に最大スコアmを見つける必要があります。これは、エミュレートすることによって行うことができる。すべてのラウンドをプレイした後だけで選手を反復し、最大スコアを持つものを選択してください。

2.Second, we need to figure out the set of players who have maximum score at the end of the game. We can do this in the same way as calculating maximum score. Just iterate over players after all rounds played and store all players with score equal to m.
第二に、我々はゲーム終了時に最大のスコアを持っているプレイヤーの集合を把握する必要があります。私たちは、最大のスコアを計算すると同じようにこれを行うことができます。ただ、すべてのラウンドをプレイした後に選手を反復し、Mに等しいスコアを持つすべてのプレーヤーを格納します。

3.And the last, we need to find a winner. To do this we will emulate the game one more time looking for player from the winner list with score not less m after some round.
そして最後に、我々は勝者を見つける必要があります。これを行うために我々はいくつかのラウンド後のスコア小さくないmの勝者のリストから選手を探していたゲームをもう一度をエミュレートします。

http://codeforces.com/blog/entry/107
Simple problem, just code it.
At the first pass calculate the sum of points for each player at game end. Let M be the maximum of these sums. At the second pass check every round. If current player X has not less than M points and his final score is equal to M then he is the winner.
The following test illustrates that player could receive more than M points, then lose some and, finally, win.
単純な問題、それをコーディングします。
最初のパスでゲーム終了時に各プレイヤーのためのポイントの合計を計算します。 Mはこれらの和の最大値とする。第二パスですべてのラウンドをご確認ください。現在のプレーヤーのXが以下Mよりもポイントがあり、彼の最終的なスコアは、Mに等しい場合には、彼は勝者である。
次のテストでは、そのプレイヤーはいくつかを失うそして、以上のMポイントを受け取ると、最終的には、勝つことが示しています。
2559602 daidailanlanさんの写しです。

a.py
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
l=[raw_input().split() for i in range(int(raw_input()))]
d={}
for x,y in l:
#リストにしたものを0番目からx:名前 y:点数で取り出す
#辞書内のキー値と一致した名前の点数を加算処理
#元々は空で作られている辞書なのでキー一致がなければ、キー値: 点数が追加される。
    d[x]=d.get(x,0)+int(y)
#最高点を調べる
w=max(d.values())
##ここまでで方針1,2の段階かな?

#そしてゲームをもう一度エミュレート?
m={}
for x,y in l:
#もう一度リストlを回してmへ格納
    m[x]=m.get(x,0)+int(y)
#前回のforで記録した最高点以上 and 前回の集計で最高点者であること?
    if m[x]>=w and d[x] ==w:
#勝利条件の成立したxをprintして breakで抜ける
        print x
        break
l=[raw_input().split() for i in range(int(raw_input()))]
# [['mike', '3'], ['andrew', '5'], ['mike', '2']]

で改行されてるn個の要素みたいなの受け取りを一行で書けるらしい。
リストの要素数によって何箇所かでforやwhileするなら、問題文に合わせて(大体はnとか)nに代入とかしたほうがよさそうな。len(n)でも代用できますけど。。

for x,y in l:
#x,yがどんな値になってるかを確認すると
#mike 3
#andrew 5
#mike 2

for x in l: としても名前だけを取り出すわけではなく、['mike','3']が出てくる。

B. The least round way

ざっくりと大意
n*nで正方形に(負ではない)整数が並んでいる。
・左上からスタートして右下がゴール
通り道の全ての数字を掛け算して四捨五入する。

C. Commentator problem

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1