Hello , please let me know for which test case it is falling
Solution: 46363012 | CodeChef
https://www.codechef.com/viewsolution/46363012
My Algorithm:-
1)Nodecount Map contains the number of nodes under this
2)x_at_node it contains x value at each node
3)once x_at_node table populated, suming all x’s mod of1000000007

On Wed, 19 Aug 2020, 19:45 Quentin, <[email protected]> wrote:

> Hello all,
>
> I am trying to solve the Stable Wall problem but I got a WA even for the
> first use case but I don't know why ?
> I tried multiple use case and all is ok on my side but not ok on the
> Judgment engine.
>
> Here is my code :
>
>
>
>
> import java.util.ArrayList;
> import java.util.Arrays;
> import java.util.Collections;
> import java.util.HashSet;
> import java.util.Iterator;
> import java.util.LinkedHashSet;
> import java.util.LinkedList;
> import java.util.List;
> import java.util.Scanner;
> import java.util.Set;
> import java.util.stream.Collectors;
>
>
> public class Solution {
>
>
>
>
>  static Solution sol = new Solution();
>
>
>  public static void main(String[] args) {
>  Scanner scann = new Scanner(System.in);  // Create a Scanner object
>  int T = scann.nextInt();
>
>
>  for(int usease = 0; usease< T;usease++) {
>  boolean hasSolution = false;
>  int R = scann.nextInt();
>  int C = scann.nextInt();
>  LinkedHashSet<String> solution = new LinkedHashSet<>();
>  Set<String> allPolyominos = new HashSet<>();
>
>  List<List<String>> table = new ArrayList<>();
>
>  for(int i = 0;i < R ;i++) {
>  List<String> currentLine = Arrays.asList(scann.next().split(""));
>  table.add(currentLine);
>  allPolyominos.addAll(currentLine.stream().collect(Collectors.toSet()));
>  if(i>0) {//If not the first line
>  List<String> previousLine = table.get(i-1);
>  for(int j = 0 ; j < C ; j++) {
>  if(!currentLine.get(j).contentEquals(previousLine.get(j))) {//Check each
> cell of the current line with the previous from top to bottom and if
> different add the previous line Polyominos
>  solution.add(previousLine.get(j));
>  }
>  }
>  }
>  }
>
>  if(allPolyominos.size()!=solution.size()) {//There is a solution if all
> Polyominos are not in the solution list, meaning a Polyominos reach the
> bottom of the Wall
>  allPolyominos.removeAll(solution);
>  solution.addAll(allPolyominos);
>  hasSolution= true;
>  }
>
>
>  //Format the answer
>  Iterator<String> iterator = solution.iterator();
>  StringBuilder sb = new StringBuilder();
>  while(iterator.hasNext()) {
>  sb.append(iterator.next());
>  }
>
>
>
>  if(hasSolution)
>  System.out.println(String.format("Case #%s: %s",usease+1,sb.reverse().
> toString()));
>  else
>  System.out.println(String.format("Case #%s: -1",usease+1));
>
>
>  }
>
>
>
>
>  }
>
>
>
> }
>
>
> If you see any mistakes, thx.
> Regards
>
> Quentin
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Code Jam" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/72f769a6-7fcc-4399-b87f-3c59199245aao%40googlegroups.com
> <https://groups.google.com/d/msgid/google-code/72f769a6-7fcc-4399-b87f-3c59199245aao%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
-- You received this message because you are subscribed to the Google Groups 
Code Jam group. To post to this group, send email to 
[email protected]. To unsubscribe from this group, send email to 
[email protected]. For more options, visit this group at 
https://groups.google.com/d/forum/google-code?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAH5vfnPA4faDfybGi%3D_B%3Dj_J47KbdQjR0Jp9KMyaFOeYqL9%3Dhw%40mail.gmail.com.

Reply via email to