7-11 quietly attention (25 points)

Source: Internet
Author: User

Topic links
On Sina Weibo, there is a "quiet attention", a user who is quietly watching, not appearing on the user's list of concerns, but the system pushes tweets from people who are quietly concerned about it to 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 first line to give a user's attention list, 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-bit string of numbers and English letters, separated by a space. The
is then given the user's point of praise: First give a positive integer m that is not more than 10000, and then line m, each row gives a user ID of its point and the number of points of praise for that user (no 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 are more likely to be praised by the user than the average number of points, and are not on their list of concerns, are probably the people they are quietly watching. 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."
Input Sample 1:
GAO3 magi Zha1 Sen1 Quan famk lsum eins fatm Llao
8
Magi $
Pota
Llao 3
Am My
Dave
GAO3
Zoro 1
Cath
Output Sample 1:
Ammy
Cath
Pota
Input Sample 2:
One GAO 3 Magi Zha1 Sen1 Quan famk lsum eins fatm llao Pota
7
Magi
Pota
Llao
Ammy 3
Dave 15
GAO3
Zoro
Output Sample 2:
Bing Mei you

#include <iostream> #include <algorithm> #include <set> using namespace std;
    typedef struct cmp{bool Operator () (string s1,string s2) {return S1 < S2;
}}cmp;
    int main () {int n,m,xs[10001];
    Double sm = 0,mean;
    Set<string> s;
    set<string,cmp> S1;
    scanf ("%d", &n);
        for (int i = 0;i < n;i++) {string x;
        CIN >> X;
    S.insert (x);
    } scanf ("%d", &m);
    String ss[10001];
        for (int i = 0;i < m;i++) {cin >> ss[i] >> xs[i];
    SM + + xs[i];
    } mean = sm/m;
    int flag = 1;
    Set<string>::iterator it;
            for (int i = 0;i < m;i++) if (xs[i]>mean) {it = S.find (ss[i));
                if (It==s.end ()) {flag = 0;
            S1.insert (Ss[i]);
    } if (flag) printf ("Bing Mei you\n");
        else{set <string,cmp>::iterator it1; for (it1 = S1.begin (); It1!= S1.end (); it1++) cout << *it1 << 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.