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 k=0;
  19. int n=sc.nextInt();
  20. for( int i=0;i<n;i++){
  21. int temp=sc.nextInt();
  22. int count=sc.nextInt();
  23. if(temp>0){
  24. m++;
  25.  
  26. }
  27. else{
  28. max_om=Math.max(max_om,m);
  29. }
  30. max_om=Math.max(max_om,m);
  31. if(count>0){
  32. k++;
  33.  
  34. }
  35. else{
  36. max_addy=Math.max(max_addy,m);
  37. }
  38. max_addy=Math.max(max_addy,k);
  39. }
  40. if(max_om>max_addy){
  41. System.out.println("om");
  42. }
  43. else if(max_addy>max_om){
  44. System.out.println("addy");
  45. }
  46. else{
  47. System.out.println("draw");
  48. }
  49. }
  50. // your code goes here
  51. }
  52. }
  53. // your code goes here
Success #stdin #stdout 0.18s 56604KB
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
draw
draw
om