l2-019. Quietly watching

Source: Internet
Author: User
l2-019. Quietly focus on time limit MS
Memory Limit 65536 KB
Code length limit 8000 B
Standard author Chen Yue The procedure of the sentence

Sina Weibo has a "quiet attention", a user quietly focus on the person, does not appear on the user's list of concerns, but the system will push its quietly concerned about the microblog published by the user. Now we're going to be a cyber detective, picking out people who are likely to be secretly concerned, based on a list of their concerns and their point of praise for other users.

Input format:

Enter the list of concerns given to a user first in the first line, in the following format:

Number n users 1 users 2 ... User n

Where N is a positive integer of no more than 5000, each "User I" (i=1, ..., N) is the ID of the user to whom it is concerned, and is a 4-digit string of numbers and English letters, separated by a space.

Then give the user a point of praise: First give a positive integer m not more than 10000, followed by M row, each row gives a user ID of its point and the number of points of praise for the user (not more than 1000), separated by a space. Note: The user ID is the unique identity of a user. The topic ensures that there are no duplicate users in the attention list, and there is no duplicate user in the point-praise message.

Output format:

We think people who have been praised by the user more than their point-praise averages, and are not on their list of concerns, are likely to be the people they secretly focus on. Based on this assumption, you can print the user ID alphabetically in ascending order by the person who may be secretly concerned, 1 IDs per line. If there is no such person, then output "Bing Mei you." Enter Sample 1:

Magi Zha1 Sen1 Quan famk lsum eins fatm llao 8 magi GAO3 Pota llao
3
ammy to
Dave
GAO3
Zoro 1
Cath 60
Output Sample 1:
Ammy
Cath
Pota
Enter Sample 2:
One GAO3 magi Zha1 Sen1 Quan famk lsum eins fatm llao Pota
7
magi Pota Llao m
ammy 3
D Ave
GAO3
Zoro 29
Output Sample 2:
Bing Mei You
#include <iostream> #include <string> #include <algorithm> #include <vector> #include <map

> Using namespace std;
        struct Node {string ss;
int z;

};
        BOOL CMP (node A,node b) {if (A.SS&GT;B.SS) return false;
return true;
    int main () {int n;
            while (Cin>>n) {string S;
            map<string,int>a;
            Node b[10010];
                    for (int i=0;i<n;i++) {cin>>s;
            A[s]=1;
            int x,m;
            Double avg=0;
            int j=0;
            cin>>m;
                    for (int i=0;i<m;i++) {cin>>b[i].ss>>b[i].z;
            Avg+=b[i].z;
            }//for (int i=0;i<m;i++)//cout<<b[i].ss<<endl;
            Avg/=m;
            Sort (b,b+m,cmp);
   cout<<avg<<endl;         for (int i=0;i<j;i++)//cout<<b[i].ss<<endl;
            int = =;
                            for (int i=0;i<m;i++) {if (B[I].Z&GT;AVG&AMP;&AMP;!A[B[I].SS]) {
                            cout<<b[i].ss<<endl;
                    P=1;
    } if (!p) cout<< "Bing Mei You" <<endl;
return 0;
 }



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.