DCP-86: Round Robin Tournament Back to All Problems

Beginner Beginners Problems > Ad-hoc

In theory, a round-robin tournament is the fairest way to determine the champion among a known and fixed number of participants. Each participant, player or team, has equal chances against all other opposites. The element of luck is seen to be reduced as compared to a knockout system since bad performances need not cripple a competitor's chance of ultimate victory. Final records of participants are, thus, seen to be more accurate as they represent the results over a longer period against equal competition. This can also be used to determine which teams are the poorest performers and thus subject to relegation if the format is used in a multi-tiered league. This is also helpful to determine the final rank of all competitors from strongest to weakest for purposes of qualification for another stage or competition as well as for prize money. In team sport the (round-robin) major league champions is generally regarded as the "best" team in the land, rather than the (elimination) cup winners. Moreover, in tournaments such as the FIFA or ICC world cups, a first round stage consisting of a number of mini round robins between groups of 4 teams guards against the possibility of a team travelling possibly thousands of miles only to be eliminated after just one poor performance in a straight knockout system. The top one, two, or occasionally three teams in these groups then proceed to a straight knockout stage for the remainder of the tournament. The main disadvantage of a round robin tournament is the time needed to complete it. Unlike a knockout tournament where half of the participants are eliminated after each round, a round robin requires one round less than the number of participants if the number of participants is even, and as many rounds as participants if the number of participants is odd. For instance, a tournament of 16 teams can be completed in just 4 rounds (i.e. 15 matches) in a knockout format; a round-robin would require 15 rounds (i.e. 120 matches) to finish. Other issues stem from the difference between the theoretical fairness of the round robin format and practice in a real event. Since the victor is gradually arrived at through multiple rounds of play, teams who perform poorly can be eliminated from title contention rather early on, yet they are forced to play out their remaining games. Thus games occur late in competition between competitors with no remaining chance of success. Moreover, some later matches will pair one competitor who has something left to play for against another who does not. It may also be possible for a competitor to play the strongest opponents in a round robin in quick succession while others play them intermittently with weaker opposition. This asymmetry means that playing the same opponents is not necessarily equitable: the same opponents in a different order may play harder or easier matches while other teams are presented with more adversity during periods of the competition. There is also no scheduled showcase final match. Only by coincidence would two competitors meet in the final match of the tournament where the result of that match determined the championship. A notable instance of this occurring was the May 26th, 1989 match between Arsenal and Liverpool. Further issues arise where a round-robin is used as a qualifying round within a larger tournament. A competitor already qualified for the next stage before its last game may either not try hard (in order to conserve resources for the next phase) or even deliberately lose (if the scheduled next-phase opponent for a lower-placed qualifier is perceived to be easier than for a higher-placed one). Four pairs in the 2012 Olympics Women's doubles badminton having qualified for the next round, were disqualified for attempting to lose in the round robin stage to avoid compatriots and better ranked opponents. The round robin stage at the Olympics were a new introduction and potential problems were readily known prior to the tournament. Swiss system tournaments attempt to combine elements of the round-robin and elimination formats, to provide a reliable champion using fewer rounds than a round-robin, while allowing draws and losses. Now give you N teams. You have to tell how many matches are required to complete a round robin tournament? Input: ------ At first gives you an integer **T (T<=100000)**, is the number of test cases. Each case gives you a 64 bit unsigned integer X. Output: ------- For every test case, print case number and number of matches required to complete a round robin tournament. Sample Input ------------ 2 3 5 Sample Output ------------- Case 1: 3 Case 2: 10

Problem Setter:

Rajon Bardhan

Please login to submit solution to this problem.

Problem Limits

Language Time Limit (seconds)
C 2.00
C++ 2.00
C++14 2.00
C# 2.00
Go 2.00
Java 2.00
JavaScript 2.00
Objective-C 2.00
Perl 2.00
PHP 2.00
Python 2.00
Python3 2.00
Ruby 2.00
VB.Net 2.00

Problem Stats




# User Language Timing
01 MAHRahat Cpp14 0.00s
02 feodorv C 0.01s
03 Morass Cpp14 0.01s
04 sajib_kumar_biswas Cpp 0.02s
05 subhashis_cse Cpp 0.03s
06 masba Python 0.06s
07 koushiq Cpp14 0.07s
08 tariqiitju Cpp14 0.07s
09 neel71 Python3 0.09s
10 RandyWaterhouse Python3 0.09s
11 milon019 Cpp 0.21s
12 smjlord068 Cpp14 0.26s
13 rafsanulhasan Cpp 0.31s
14 Saimum_140128 Cpp14 0.38s
15 njrafi Cpp14 0.38s
16 7Mahfuz Cpp14 0.39s
17 joy25896 Cpp14 0.40s
18 ksohan Cpp14 0.40s
19 sahedsohel Cpp14 0.42s
20 mamun Cpp14 0.45s
21 rayhan50001 Cpp14 0.45s
22 abuasifkhan Cpp14 0.48s
23 dipta007 Cpp14 0.56s
24 mamun4122 Cpp14 0.57s
25 khatribiru Cpp14 0.60s
26 Roll_Number_27 Cpp14 0.63s
27 Matrix_code Cpp14 0.64s
28 KIRIN_36 Cpp14 0.64s
29 nfssdq Cpp14 0.64s
30 showmic Cpp14 0.64s
31 moinul_shaon Cpp14 0.66s
32 raihatneloy Cpp14 0.66s
33 ddevilred1 Cpp14 0.79s
34 mahbubcseju Cpp14 0.79s
35 Shakerh5027 Java 0.83s
36 ssavi Cpp14 0.84s
37 devcoder Java 0.85s
38 Afif_Fahim Java 0.86s
39 zubayerhossain Java 0.88s
40 akazad_cse13_ruet Cpp14 1.00s
41 faisal47 Cpp14 1.14s
42 Not_Found0001 Java 1.32s
43 mahbub07 Java 1.33s
44 lolcoder Java 1.33s
45 Dinar Java 1.35s
46 haasib Java 1.66s

Your feedback is our precious!

Or call +88 02 9853138 for support