Codeforces Round #281 (Div. 2) Problem solving report a.b.c.d.

Source: Internet
Author: User

A-vasya and Football

Pure simulation. Compared to the pit, there will be a place that does not meet the common sense of football.

The code is as follows:

#include <iostream> #include <cstdio> #include <string> #include <cstring> #include < stdlib.h> #include <math.h> #include <ctype.h> #include <queue> #include <map> #include < Set> #include <algorithm>using namespace std; #define LL __int64const int inf=0x3f3f3f3f;struct node{int nu        M, time, F; char AH;} Fei[100];int CMP (node x, node Y) {return x.time<y.time;}        int foul (char c) {if (c== ' Y ') return 1; return 2;}        int main () {char s1[30], s2[30], C1, C2;        int n, I, J, T, cnt=0, NUM, flag;        scanf ("%s%s", S1,S2);        scanf ("%d", &n);                for (i=0;i<n;i++) {scanf ("%d%c%d%c", &AMP;T,&AMP;C1,&AMP;NUM,&AMP;C2);                flag=0;                                for (j=0;j<cnt;j++) {if (fei[j].ah==c1&&fei[j].num==num) {                                Fei[j].f+=foul (C2);                     if (Fei[j].f-foul (C2) <2)           fei[j].time=t;                                flag=1;                        Break                        }} if (!flag) {fei[cnt].num=num;                        fei[cnt].time=t;                        FEI[CNT].AH=C1;                Fei[cnt++].f=foul (C2);        }} sort (fei,fei+cnt,cmp);                        for (i=0;i<cnt;i++) {if (fei[i].f>=2) {if (fei[i].ah== ' h ') printf ("%s", S1);                        else printf ("%s", S2);                printf ("%d%d\n", fei[i].num,fei[i].time); }} return 0;}

B-vasya and Wrestling

Water problem. Compare and then compare the dictionary order according to test instructions. There's really nothing to say.

The code is as follows:

#include <iostream> #include <cstdio> #include <string> #include <cstring> #include < stdlib.h> #include <math.h> #include <ctype.h> #include <queue> #include <map> #include < Set> #include <algorithm>using namespace std; #define LL __int64const int inf=0x3f3f3f3f;        ll a[210000], B[210000];int main () {LL cnt1=0, cnt2=0, N, x, s1=0, s2=0, t;        int i;        scanf ("%i64d", &n);                while (n--) {scanf ("%i64d", &x);                        if (x>0) {a[cnt1++]=x;                S1+=x;                        } else{b[cnt2++]=-x;                S2-=x;        } if (n==0) t=x>0?1:2;        } if (S1&GT;S2) printf ("first\n");        else if (S1&LT;S2) printf ("second\n");                else{int flag=0;              for (i=0;i<cnt1&&i<cnt2;i++) {if (A[i]>b[i]) {                  flag=1;                        Break                                } else if (A[i]<b[i]) {flag=2;                        Break                }} if (Flag==1) puts ("first");                else if (flag==2) puts ("second");                else if (Cnt1>cnt2) puts ("first");                else if (Cnt1<cnt2) puts ("second");                else if (t==1) puts ("first");        Else puts ("second"); } return 0;}
C-vasya and Basketball

is also a water problem. But I just knelt down. A variety of details hand-mutilated. It was wrong 11 times. The middle also handed to the D question to go once ...

First of all the various occurrences of the number of storage, sorting, and then the two points to determine how many points, how many three points, the maximum value can be found.

The code is as follows:

#include <iostream> #include <cstdio> #include <string> #include <cstring> #include < stdlib.h> #include <math.h> #include <ctype.h> #include <queue> #include <map> #include < Set> #include <algorithm>using namespace std; #define LL __int64const int inf=0x3f3f3f3f;int a[210000], b[210000        ], N, M, c[420000], f[420000];int bin_search (int d[], int x, int high) {int low=1, Mid, ans=0;                while (Low<=high) {mid=low+high>>1;                        if (d[mid]<=x) {ans=mid;                low=mid+1;        } else high=mid-1; } return ans;        int main () {int i, j, AA, BB, max1=-2*1e9, x, Y, Z, cnt=1, p1, p2;        scanf ("%d", &n);                for (I=1; i<=n; i++) {scanf ("%d", &a[i]);        C[i]=a[i];        } scanf ("%d", &m);           for (I=1; i<=m; i++) {scanf ("%d", &b[i]);     C[i+n]=b[i];        } sort (c+1,c+n+m+1);        Sort (a+1,a+n+1);        Sort (b+1,b+m+1);        c[0]=0;        f[0]=0;                for (i=1;i<=n+m;i++) {if (c[i]!=c[i-1]) {f[cnt++]=c[i];                }} for (i=0;i<cnt;i++) {x=bin_search (a,f[i],n);                Y=bin_search (B,F[I],M);                p1=x*2+ (n-x);                                p2=y*2+ (M-Y);                        if (MAX1&LT;P1-P2) {max1=p1-p2;                        AA=P1;                BB=P2;        }} printf ("%d:%d\n", AA,BB); return 0;}

D-vasya and Chess

Guess question, so I guess, prove not.

The code is as follows:

#include <iostream> #include <cstdio> #include <string> #include <cstring> #include < stdlib.h> #include <math.h> #include <ctype.h> #include <queue> #include <map> #include < Set> #include <algorithm>using namespace std; #define LL __int64const int Inf=0x3f3f3f3f;int main () {        int n;< C3/>SCANF ("%d", &n);        if (n%2==0)  printf ("white\n1 2\n");        else                printf ("black\n");        return 0;}

Codeforces Round #281 (Div. 2) Problem solving report a.b.c.d.

Related Article

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: 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.