题目的意思是求出每个队穿主场衣服和客场衣服的次数

每个队作为主场的次数是n-1,作为客场的次数是n-1

当每个队打主场的时候肯定穿的主场衣服

当每个队打客场时,如果客场与主场的衣服不同,则穿客场衣服

           如果客场与主场的衣服相同,则穿主场衣服

则只需要标记主场每种衣服有多少球队,当作为客场时查找与客场颜色相同的主场球队有多少即可

#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
using namespace std; int main(){
int n;
cin >> n;
vector<int> home(n,),away(n,);
map<int,int> cnt;
for(int i = ; i < n; ++ i ){
cin >> home[i] >> away[i];
if(cnt.find(home[i]) == cnt.end()) cnt.insert(make_pair(home[i],));
else cnt[home[i]] ++ ;
}
for(int i = ; i < n ; ++ i){
cout<<n-+cnt[away[i]]<<" "<<n--cnt[away[i]]<<endl;
}
}

Codeforces Round #246 (Div. 2) B. Football Kit的更多相关文章

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

    B. Football Kit time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...

  2. Codeforces Round #246 (Div. 2)

    题目链接:Codeforces Round #246 (Div. 2) A:直接找满足的人数,然后整除3就是答案 B:开一个vis数组记录每一个衣服的主场和客场出现次数.然后输出的时候主场数量加上反复 ...

  3. Codeforces Round #246 (Div. 2) D. Prefixes and Suffixes

                                                        D. Prefixes and Suffixes You have a string s = s ...

  4. Codeforces Round #246 (Div. 2) C. Prime Swaps(贪心,数论)

    题目链接:http://codeforces.com/contest/432/problem/C 首先由题意分析出:这些数是从1到n且各不相同,所以最后结果肯定是第i位的数就是i. 采用这样一种贪心策 ...

  5. Codeforces Round #246 (Div. 2) A. Choosing Teams

    给定n k以及n个人已参加的比赛数,让你判断最少还能参加k次比赛的队伍数,每对3人,每个人最多参加5次比赛 #include <iostream> using namespace std; ...

  6. Codeforces Round #246 (Div. 2)——D题

    KMP算法,没写出来,完全不理解NEXT数组.现在理解了很多 答案都在程序中 ,不过这个思想真的很神奇, 还有毛语不好,一直没看懂题目,现在懂了, 大概是:S中前缀等于后缀,求其长度,和其在S中出现了 ...

  7. Codeforces Round #246 (Div. 2) D. Prefixes and Suffixes(后缀数组orKMP)

    D. Prefixes and Suffixes time limit per test 1 second memory limit per test 256 megabytes input stan ...

  8. Codeforces Round #246 (Div. 2) D E

    这题说的是给了一个字符串当前缀和后缀相同的时候就计算此时的 整个串种拥有这样的子串友多少个,没想到用KMP解 用0开头的那种类型的 KMP 今天刚好也学了一下,因为KMP的作用是找出最长前缀 KMP ...

  9. Codeforces Round #403 (Div. 2, based on Technocup 2017 Finals)

    Codeforces Round #403 (Div. 2, based on Technocup 2017 Finals) 说一点东西: 昨天晚上$9:05$开始太不好了,我在学校学校$9:40$放 ...

随机推荐

  1. C#的lock关键字

    using System; using System.Threading; namespace Test { class Program { //一.Lock定义 //lock 关键字可以用来确保代码 ...

  2. 使用Autofac在ASP.NET Web API上实现依赖注入

    在ASP.NET Web API里使用Autofac 1.通过NuGet安装Autofac.WebApi(当时安装的是Autofac 3.1.0) PM > Install-Package Au ...

  3. 【翻译十】java-固定锁和同步

    Intrinsic Locks and Synchronization Synchronization is built around an internal entity known as the  ...

  4. Linux进程状态 ( Linux Process State Codes)

    进程状态代码及说明: STATE代码 说明 D 不可中断的睡眠. 通常是处于I/O之中. R 运行中/可运行. 正处于运行队列中. S 可中断的睡眠. 等待某事件发生. T 已停止. 可能是因为she ...

  5. list[C++]

    //双向链表 #include <iostream> using namespace std; #include <list> int main(int argc, const ...

  6. 学习iOS的网站

    ios开发者 http://www.codeios.com/   cocoachina http://www.cocoachina.com   code4app http://code4app.com ...

  7. HDU 5918 Sequence I KMP

    Sequence I Problem Description   Mr. Frog has two sequences a1,a2,⋯,an and b1,b2,⋯,bm and a number p ...

  8. loj 1357(树形dp)

    题目链接:http://lightoj.com/volume_showproblem.php?problem=1357 #define _CRT_SECURE_NO_WARNINGS #include ...

  9. 获取内核当前执行模块和当前发生异常地址和线程异常Handler调用步骤

    循环每个内核模块 统计模块大小 判断触发异常的地址属于那个模块.来确定模块 获取发生异常地址 nt!_EXCEPTION_RECORD +0x000 ExceptionCode : -21391605 ...

  10. 在苹果手机上input有内阴影怎么去除

    一个input中在安卓手机上完全按照自己的样式去展示,但是在苹果手机上发现Input有内阴影,怎么去除内阴影呢? 在input样式中这样添加 #div{ .... appearance:button; ...