Solution found similiar

Revision en1, by st1008, 2023-07-14 21:17:05

My solution to a recent problem was found very similar to another user however the question had little to do with logic. It was a simple question that required a very trivial solution.

here is the link: https://mirror.codeforces.com/contest/1846/problem/A

and my submission: /* package codechef; // don't place package name! */

import java.util.*; import java.lang.*; import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) throws java.lang.Exception { // your code goes here Scanner sc =new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); int a[]=new int[n]; int b[]=new int[n]; for(int i=0;i<n;i++) { a[i]=sc.nextInt(); b[i]=sc.nextInt();

     }
     int c=0;
     for(int i=0;i<n;i++)
     {
         if(a[i]>b[i])
         c++;
     }
     System.out.println(c);

 }
}

}

What should I do to avoid any penalties?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English st1008 2023-07-14 21:17:05 1080 Initial revision (published)