


Codeforces Round #246 (Div. 2) ?B. Football Kit_html/css_WEB-ITnose
B. Football Kit
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
Consider a football tournament where n teams participate. Each team has two football kits: for home games, and for away games. The kit for home games of the i-th team has color xi and the kit for away games of this team has color yi (xi?≠?yi).
In the tournament, each team plays exactly one home game and exactly one away game with each other team (n(n?-?1) games in total). The team, that plays the home game, traditionally plays in its home kit. The team that plays an away game plays in its away kit. However, if two teams has the kits of the same color, they cannot be distinguished. In this case the away team plays in its home kit.
Calculate how many games in the described tournament each team plays in its home kit and how many games it plays in its away kit.
Input
The first line contains a single integer n (2?≤?n?≤?105) ? the number of teams. Next n lines contain the description of the teams. The i-th line contains two space-separated numbers xi, yi (1?≤?xi,?yi?≤?105; xi?≠?yi) ? the color numbers for the home and away kits of the i-th team.
Output
For each team, print on a single line two space-separated integers ? the number of games this team is going to play in home and away kits, correspondingly. Print the answers for the teams in the order they appeared in the input.
Sample test(s)
input
21 22 1
output
2 02 0
input
31 22 11 3
output
3 14 02 2
打印当前队 穿主场衣服作战的次数 和 穿客场衣服作战的次数
简单的哈希思想 规律 即可AC,只是 题意不是很好理解
规律是 n个队 没有个队会进行 n-1次 比赛 主场服使用次数 客场服使用次数 = 2*(n-1)
主场服使用次数 = n-1 当前队客场服与其他队 主场服相同的次数
#include <stdio.h>#include <stdlib.h>#include <string.h>int a[100010];int b[100010],c[100010];int main(){ int n,i; scanf("%d",&n); memset(a,0,sizeof(a)); for(i = 0; i<n; i++) { scanf("%d%d",&b[i],&c[i]); a[b[i]]++; } for(i = 0; i<n; i++) { printf("%d %d\n",n-1+a[c[i]],2*(n-1)-(n-1+a[c[i]])); } 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



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

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 <datalist> element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

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 <iframe> tag's purpose in embedding external content into webpages, its common uses, security risks, and alternatives like object tags and APIs.

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