CF 432B :Football Kit

hash做法:


#include<stdio.h>
#include<string.h>
const int Max = 100010;
int home[Max],away[Max],hash[Max];
int main()
{
int n,sum,total;
int i,j;
while(scanf("%d",&n)!=EOF)
{
sum = 0;
total = 2*(n-1);
for(i=0;i<n;i++)
scanf("%d %d",&home[i],&away[i]);
memset(hash,0,sizeof(hash));
for(i=0;i<n;i++)
hash[home[i]]++;//重复出现的主场number
for(i=0;i<n;i++)
printf("%d %d\n",n-1+hash[away[i]],n-1-hash[away[i]]);

}
return 0;
}

CF 432B :Football Kit

时间: 2024-08-10 21:28:49

CF 432B :Football Kit的相关文章

432B - Football Kit

解题思路: 暴力绝对TLE 一个队伍穿主场球衣的次数 = 这个队伍的客场球衣颜色与其他队主场球衣颜色起冲突的次数 + (n - 1) #include <stdio.h> #include <string.h> #include <iostream> using namespace std; const int MAXSIZE = 100; const int INF = 0x3f3f3f3f; int a[100001], b[100001], c[100001],

CodeForces 432B Football Kit

Football Kit Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 432B Description Consider a football tournament where n teams participate. Each team has two football kits: for home games, a

CodeForces 432B Football Kit(水)

Description 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 ≠ 

Codeforces Round #246 (Div. 2) B. Football Kit

题目的意思是求出每个队穿主场衣服和客场衣服的次数 每个队作为主场的次数是n-1,作为客场的次数是n-1 当每个队打主场的时候肯定穿的主场衣服 当每个队打客场时,如果客场与主场的衣服不同,则穿客场衣服   如果客场与主场的衣服相同,则穿主场衣服 则只需要标记主场每种衣服有多少球队,当作为客场时查找与客场颜色相同的主场球队有多少即可 #include <iostream> #include <map> #include <vector> #include <algor

Codeforces Round #246 (Div. 2)

A.Choosing Teams 水题 #include <cstdio> #include <cstring> using namespace std; int main() { int n, k, ans, i, x; scanf("%d%d",&n,&k); ans = 0; for(i=0; i<n; ++i) { scanf("%d",&x); if(5-x >= k) ans++; } ans

Codeforces Round #246 (Div. 2) (ABCD详细题解)

比赛链接:http://codeforces.com/contest/432 A. Choosing Teams time limit per test:1 second memory limit per test:256 megabytes The Saratov State University Olympiad Programmers Training Center (SSU OPTC) has n students. For each student you know the numbe

CF 1244 C - The Football Season

C - The Football Season 先考虑求解 \[ x\times w + y\times d=p \] 若存在一组解 \[ \begin{cases} x_0\y_0 = kw + v & (0<v<w)\\end{cases} \] 则 \[ x_0 \times w + y_0 \times d = p\\Rightarrow x_0 \times w + (kw+v)\times d = p\\Rightarrow x_0\times w + k\times w\

微信 {&quot;errcode&quot;:40029,&quot;errmsg&quot;:&quot;invalid code, hints: [ req_id: Cf.y.a0389s108 ]&quot;}

{"errcode":40029,"errmsg":"invalid code, hints: [ req_id: Cf.y.a0389s108 ]"} 问题:微信网页授权后,获取到 openid 了,一刷新又没了 微信网页授权获取到的 code 只能使用一次(5分钟内有效),使用一次后,马上失效. 页面授权跳转成功,根据 code 也换取到 openid 了. 此时刷新页面,并不会再次进行授权,而是直接刷新了一下上一次授权跳转后的链接,带的还是

Codeforces Round #281 (Div. 2) A. Vasya and Football 暴力

A. Vasya and Football Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red