[模拟][YandexAlgorithm2013T1]Ancient Basketball

来源:互联网 发布:网络视频直播软件 编辑:程序博客网 时间:2024/05/16 13:38

Ancient Basketball

Time limit2 secondsMemory limit256MbInputstdinOutputstdout

Legend

A few days ago, Byteland archaeologists found the scoreboard of the very first basketball game in Byteland. Because of the historical significance of the event Bytelanders want to reconstruct the results.

It is known that Byteland rules of basketball are similar to basketball rules nowadays:

  • team earns 1 point for each goal scored from a free throw;
  • team earns 2 points for a field goal;
  • team earns 3 points for a goal scored from behind the three-point line.

    It is also known that, if the distance between the hoop and the player who scored the goal does not exceedL, then the goal counts as a field goal. Otherwise, it counts as a three-point throw. Archaeologists ask you to find out the result of the game based on the information about scored goals.

Input format

First line of input contains two integers n (1 ≤ n ≤ 1000) andL (1 ≤ L ≤ 30): the number of recorded scored balls and the distance from the hoop to the three-point line.

Each of the n next lines contains two integer numbersti (1 ≤ ti ≤ 2) anddi (-1 ≤ di ≤ 50). Ifdi ≥ 0 then player from the team ti scored a goal from distance di. Ifdi = -1, player from team ti scored a goal from a free throw.

Output format

In the only line of output, print the result of the game: the number of points earned by first team and the number of score points earned by second team. Separate the numbers by a colon.

Sample 1

InputOutput
3 51 22 51 10
5:2

Sample 2

InputOutput
4 101 21 -11 201 20
9:0

#include <cstdio>int score[3];int main(){int n,l;scanf("%d%d",&n,&l);for (int i=1;i<n+1;i++){int t,d;scanf("%d%d",&t,&d);if (d == -1)score[t] ++;else if (d <= l)score[t] += 2;elsescore[t] += 3;}printf("%d:%d",score[1],score[2]);return 0;}