Codeforces Beta Round #2 A. Winner

http://codeforces.com/contest/2/problem/A

Ideal: Give you some people's results

Seeking the name of the people who have the greatest achievement

If there are many outputs, the first to be up> = RET && End> = RET

ACcode:

#include<bits/stdc++.h>
using namespace std;
string name[1000100];
int score[1000100];
int main()
{
    int n;
    scanf("%d", &n);
    map<string, int>m;
    m.clear();
    int ret = -1e9;
    for(int i = 1; i <= n; i++)
    {
        cin >> name[i] >> score[i];
        m[name[i]] += score[i];
    }
    for(int i = 1; i <= n; i++)
        ret = max(ret, m[name[i]]);
    map<string, int>c;
    c.clear();
    for(int i = 1; i <= n; i++)
    {
        c[name[i]] += score[i];
        if(m[name[i]] >= ret && c[name[i]] >= ret)
        {
            cout << name[i] << endl;
            break;
        }
    }
    return 0;
}


Intelligent Recommendation

Codeforces Beta Round 77 (Div. 2 Only)

layout: post title: Codeforces Beta Round 77 (Div. 2 Only) author: "luowentaoaa" catalog: true tags: mathjax: true - codeforces Portal A - Football (Sign) The meaning of problems Q. Is there...

Codeforces Beta Round 84 (Div. 2 Only)

layout: post title: Codeforces Beta Round 84 (Div. 2 Only) author: "luowentaoaa" catalog: true tags: mathjax: true - codeforces Portal have to say this ancient field too simple A - Nearly Lu...

Codeforces Beta Round #75 (Div. 2)---A. Chips

Chips time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output There are n walruses sitting in a circle. All of them are numbered in the ...

Codeforces Beta Round #14 (Div. 2)A. Letter

A boy Bob likes to draw. Not long ago he bought a rectangular graph (checked) sheet with n rows and m columns. Bob shaded some of the squares on the sheet. Having seen his masterpi...

Codeforces Beta Round #69 (Div. 2 Only)

A - Panoramix’s Prediction Is b the first prime number greater than a B-Depression simulation C - Heroes Because there are three enemies, we use the ternary method to enumerate all situations. T...

More Recommendation

Codeforces Beta Round #73 (Div. 2 Only)

Article catalog Foreword First, the topic link 1.[A. Chord](https://codeforces.com/contest/88/problem/A) 2.[B. Keyboard](https://codeforces.com/contest/88/problem/B) 3.[C. Trains](https://codeforces.c...

[2020.4.5rating]codeforces Beta Round #92 (Div. 2 Only) (A、B)Codeforces Beta Round #95 (Div. 2)(A-C)

Write catalog title here First-level directory Secondary directory Three-level directory link A - The number of positions Question type: thinking Title: Code: B - Permutations Question type: Simulatio...

Codeforces Beta Round #2 B. The least round way

Fortunately, this problem ~ ~ 2B Subject to the effect: Given a matrix. Go left on the bottom right, you can only turn right or laid down. Each path has a grid number. The number obtained by multiplyi...

Codeforces Beta Round #2 B. The least round way dp

B. The least round way Topic connection: http://www.codeforces.com/contest/2/problem/B Description There is a square matrix n × n, consisting of non-negative integer numbers. You s...

Codeforces Beta Round # 2 B. The least round way (dynamic programming)

B. The least round way time limit per test:2 seconds memory limit per test:64 megabytes There is a square matrix n × n, consisting of non-negative integer numbers. You should ...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top