


Codeforces Round #281 (Div. 2) Solution Report A.B.C.D._html/css_WEB-ITnose
A - Vasya and Football
Pure simulation. . What is more pitiful is that there are some things that are not in line with 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 num, 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",&t,&c1,&num,&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 question. . Just compare the sum first and then compare the lexicographic order according to the meaning of the question. There's really not much 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>s2) printf("first\n"); else if(s1<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;}
It’s also a question. . But I just knelt down. . All details are missing. . I was wrong 11 times. . . . . I was also handed question D once in the middle. . .
First save the various numbers that have appeared, sort them, and then divide them into two parts to determine how many two-pointers and three-pointers there are between the two people, and just find the maximum value.
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)*3; p2=y*2+(m-y)*3; if(max1<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 I was guessing, it turns out that I can't. .
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; scanf("%d",&n); if(n%2==0) printf("white\n1 2\n"); else printf("black\n"); return 0;}

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

The article discusses the HTML <progress> element, its purpose, styling, and differences from the <meter> element. The main focus is on using <progress> for task completion and <meter> for stati

The article discusses the viewport meta tag, essential for responsive web design on mobile devices. It explains how proper use ensures optimal content scaling and user interaction, while misuse can lead to design and accessibility issues.

The article discusses the HTML <datalist> element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

The article discusses the <iframe> tag's purpose in embedding external content into webpages, its common uses, security risks, and alternatives like object tags and APIs.

The article discusses the HTML <meter> element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates <meter> from <progress> and ex

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.
