Codeforces и Polygon могут быть недоступны в период с 23 мая, 7:00 (МСК) по 23 мая, 11:00 (МСК) в связи с проведением технических работ. ×

praying for help in java

Правка en1, от PROGRAMMAR, 2017-03-27 01:50:40

I'm very tired with this "lightoj.com" problem. I tried to find java code from internet but couldn't find. since this judge requires "registration"; i share the problem here followed by my code. I know the logic. even i did it using c++ and got ac. I'm knew in JAVA. it will be helpfull if you say why my code facing "MLE"

1009 — Back to Underworld(problem name) Time Limit: 4 second(s) Memory Limit: 32 MB

The Vampires and Lykans are fighting each other to death. The war has become so fierce that, none knows who will win. The humans want to know who will survive finally. But humans are afraid of going to the battlefield.

So, they made a plan. They collected the information from the newspapers of Vampires and Lykans. They found the information about all the dual fights. Dual fight means a fight between a Lykan and a Vampire. They know the name of the dual fighters, but don't know which one of them is a Vampire or a Lykan.

So, the humans listed all the rivals. They want to find the maximum possible number of Vampires or Lykans.

Input Input starts with an integer T (≤ 10), denoting the number of test cases.

Each case contains an integer n (1 ≤ n ≤ 105), denoting the number of dual fights. Each of the next n lines will contain two different integers u v (1 ≤ u, v ≤ 20000) denoting there was a fight between u and v. No rival will be reported more than once.

Output For each case, print the case number and the maximum possible members of any race.

Sample Input Output for Sample Input 2 2 1 2 2 3 3 1 2 2 3 4 2 Case 1: 2 Case 2: 3

https://ideone.com/so3oF3

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en5 Английский PROGRAMMAR 2017-03-27 02:54:24 2 Tiny change: 'le Input\n2\n\n2\n' -> 'le Input\n\n2\n\n2\n'
en4 Английский PROGRAMMAR 2017-03-27 02:51:48 2 Tiny change: 'ase 1: 2\nCase 2: ' -> 'ase 1: 2\n\nCase 2: '
en3 Английский PROGRAMMAR 2017-03-27 02:50:23 16
en2 Английский PROGRAMMAR 2017-03-27 02:48:41 1 Tiny change: '1 ≤ n ≤ 105), denoti' -> '1 ≤ n ≤ 10^5), denoti'
en1 Английский PROGRAMMAR 2017-03-27 01:50:40 1643 Initial revision (published)