[Offer收割]编程练习赛74 register

Ended

Participants:109

Verdict:Accepted
Score:100 / 100
Submitted:2018-08-26 12:40:33

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//Code by Caproner
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
map<LL,LL> mp;
int main()
{
    int n;
    while(~scanf("%d",&n))
    {
        mp.clear();
        for(int i=0;i<n;i++)
        {
            LL x,y,w;
            scanf("%lld%lld%lld",&x,&y,&w);
            mp[x*x+y*y]+=w;
        }
        
        LL ans=-1e15;
        LL pans=0;
        for(map<LL,LL>::iterator it=mp.begin();it!=mp.end();it++)
        {
            pans+=(*it).second;
            ans=max(ans,pans);
        }
        printf("%lld\n",ans);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX