Construct Codeforces Round #107 (Div. 2) B. Phone Numbers

Source: Internet
Author: User

Topic Portal

1 /*2 Construction: The structure of the order, write some wordy, mainly want to use the flow, less the judgment condition WA several times: (3 */4#include <cstdio>5#include <algorithm>6#include <cstring>7#include <cmath>8#include <vector>9#include <map>Ten#include <iostream> One#include <string> A using namespacestd; -  - Const intMAXN = 1e2 +Ten; the Const intINF =0x3f3f3f3f; - structPhone - { -     stringname; +     stringNUM[MAXN]; -     inttot, T, p, G, id; + }P[MAXN]; A  at BOOLcmp_t (phone x, phone y) - { -     if(x.t = = y.t)returnX.id <y.id; -     returnx.t >y.t; - } -  in BOOLcmp_p (phone x, phone y) - { to     if(X.P = = Y.P)returnX.id <y.id; +     returnX.P >Y.P; - } the  * BOOLcmp_g (phone x, phone y) $ {Panax Notoginseng     if(X.G = = Y.G)returnX.id <y.id; -     returnX.G >Y.G; the } +  A intMainvoid)//codeforces Round #107 (Div. 2) B. Phone Numbers the { + //freopen ("c.in", "R", stdin); -  $     intN; $      while(Cin >>N) -     { -          for(intI=1; i<=n; ++i) the         { -CIN >> P[i].tot >> p[i].name; P[i].id =i;Wuyip[i].t = P[I].P = P[I].G =0; the              for(intj=1; j<=p[i].tot; ++j) -             { WuCIN >>P[i].num[j]; -                 if(p[i].num[j][0] = = p[i].num[j][1] && p[i].num[j][1] = = p[i].num[j][3] && Aboutp[i].num[j][3] = = p[i].num[j][4] && p[i].num[j][4] = = p[i].num[j][6] && $p[i].num[j][6] = = p[i].num[j][7]) p[i].t++; -                 Else if(p[i].num[j][0] > p[i].num[j][1] && p[i].num[j][1] > p[i].num[j][3] && -p[i].num[j][3] > p[i].num[j][4] && p[i].num[j][4] > p[i].num[j][6] && -p[i].num[j][6] > p[i].num[j][7]) p[i].p++; A             } +P[I].G = p[i].tot-p[i].t-P[I].P; the //cout << p[i].t << "<< p[i].p <<" << p[i].g << Endl; -         } $  the         intPre =0; theSort (p+1, p+1+N, cmp_t); thecout <<"If you want to call a taxi, you should call:"; the          for(intI=1; i<=n; ++i) -         { in             if(i = =1) the             { thecout << P[i].name; Pre =p[i].t; About             } the             Else if(p[i].t = = Pre) cout <<", "<<P[i].name; the             Else     Break; the         } +cout <<"."<<Endl; -Sort (p+1, p+1+N, cmp_p); thecout <<"If you want to order a pizza, you should call:";Bayi          for(intI=1; i<=n; ++i) the         { the             if(i = =1) -             { -cout << P[i].name; Pre =P[I].P; the             } the             Else if(P[I].P = = Pre) cout <<", "<<P[i].name; the             Else     Break; the         } -cout <<"."<<Endl; theSort (p+1, p+1+N, cmp_g); thecout <<"If you want to go to a café with a wonderful girl, you should call:"; the          for(intI=1; i<=n; ++i)94         { the             if(i = =1) the             { thecout << P[i].name; Pre =p[i].g;98             } About             Else if(P[I].G = = Pre) cout <<", "<<P[i].name; -             Else     Break;101         }102cout <<"."<<Endl;103     }104  the     return 0;106 }107 108 /*109 If you want the taxi, you should Call:rogulenko. the If you want to order a pizza, you should Call:fedorov, Rogulenko, Kaluzhin.111 If you want to go to a café with a wonderful girl, you should Call:melnikov. the */

Construct Codeforces Round #107 (Div. 2) B. Phone Numbers

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.