fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. Scanner sc=new Scanner(System.in);
  13. int t=sc.nextInt();
  14. while(t-->0){
  15. int max_om=0;
  16. int max_addy=0;
  17. int m=0;
  18. int i=sc.nextInt();
  19. int n=sc.nextInt();
  20. int[] temp=new int[n];
  21. int[] count=new int[n];
  22. for( i=0;i<n;i++){
  23. temp[i]=sc.nextInt();
  24. }
  25. for( i=0;i<n;i++){
  26. count[i]=sc.nextInt();
  27. }
  28. if(temp[i]>0){
  29. m++;
  30.  
  31. }
  32. else{
  33. max_om=Math.max(max_om,m);
  34. }
  35. max_om=Math.max(max_om,m);
  36. int k=0;
  37. if(count[i]>0){
  38. k++;
  39.  
  40. }
  41. else{
  42. max_addy=Math.max(max_addy,m);
  43. }
  44. max_addy=Math.max(max_addy,k);
  45. if(max_om>max_addy){
  46. System.out.println("om");
  47. }
  48. else if(max_om<max_addy){
  49. System.out.println("addy");
  50. }
  51. else{
  52. System.out.println("draw");
  53. }
  54. }
  55. // your code goes here
  56. }
  57. }
Runtime error #stdin #stdout #stderr 0.15s 56492KB
stdin
3
6
1 7 3 0 2 13
0 2 3 4 5 0
3
1 3 4
3 1 2
5
1 2 3 0 1
1 2 0 2 3
stdout
Standard output is empty
stderr
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
	at Ideone.main(Main.java:28)