introduction to online judges

20
AUTOMATIC EVALUATION OF JAVA PROGRAM THROUGH ONLINE JUDGE

Upload: mansi-jain

Post on 13-Apr-2017

117 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Introduction to online judges

AUTOMATIC

EVALUATIONOF JAVA PROGRAM

THROUGH ONLINE JUDGE

Page 2: Introduction to online judges

TABLE OF CONTENTS

l What is an Online Judge?l l Difference between User-oriented

programs and Online Judge oriented programs

l l Why do we need Ojs?l l Practices to considerl l MOSS (Massive Online Software

Similarity)l

Page 3: Introduction to online judges

WHAT IS AN OJ? Online system

Compile and execute code

Test programs with pre-constructed data

Page 4: Introduction to online judges

Offline User Oriented Program

import java.io.*;public class Add{

public static void main(String args[])throws IOExeception{

int a, b, sum;BufferedReader br=new

BufferedReader(new InputStreamReader(System.in));

System.out.println(“Enter first number:”);

a=Integer.parseInt(br.readLine());System.out.println(“Enter

second number:”);

b=Integer.parseInt(br.readLine());sum=a+b;

System.out.println(“Sum=“ +sum);}}

Online Judge Oriented Program

import java.io.*;public class Add{

public static void main(String args[])throws IOExeception{

int a, b, sum;BufferedReader br=new

BufferedReader(new InputStreamReader(System.in));a=Integer.parseInt(br.readLine()); b=Integer.parseInt(br.readLine());

sum=a+b;

System.out.println(sum);}}

|||||||||||||||||||||||||

Page 5: Introduction to online judges

WHY DO WE NEED OJS? Test on multiple data Optimize code:

Time complexitySpace complexity

Large Input

Page 6: Introduction to online judges

TIME COMPLEXITY Time limit Input Constraints

Page 7: Introduction to online judges
Page 8: Introduction to online judges

INSTEAD OF THIS

public static void main(String args[])throws IOException{

BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

String str=new String();str=br.readLine();char c;for(int i=0; i<str.length(); i++){

c=str[i];System.out.println(c);

}

}

Page 9: Introduction to online judges

WE USE THISpublic static void main(String args[])throws IOException{

BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

String str=new String();str=br.readLine();char c;int len=str.length()for(int i=0; i<len; i++){

c=str[i];System.out.println(c);

}

}

Page 10: Introduction to online judges

SPACE COMPLEXITY

Example 1

vs

Example2

Page 11: Introduction to online judges

PRACTICES TO CONSIDER

Input Methods:Scanner << BufferedReader <<

BufferedInputStream Output Methods:

PrintWriter, PrintStream >> System.out.print

Page 12: Introduction to online judges

Input and Output Format

** ** * ** * * ** * * * *

** ** * ** * * ** * * * *

Expected Output

Ouput by Your Code

Page 13: Introduction to online judges

EXAMPLES SPOJ UVa TopCoder CodeForces CodeChef HackerRank HackerEarth

Page 14: Introduction to online judges

CODECHEF

Class name - Main DO NOT PRINT (“Enter a number”)

Page 15: Introduction to online judges
Page 16: Introduction to online judges
Page 17: Introduction to online judges

MOSS – THE BOSS

Plagiarism reporter Copy Case Different Variables

Page 18: Introduction to online judges

ANY QUESTION

S?

Page 19: Introduction to online judges

CONTACT US

MANSI JAIN (TE IT A):l [email protected]

KRUSHI GADA (TE IT A):l [email protected]

VRISHABH LAKHANI (TE IT B):l [email protected]

Page 20: Introduction to online judges

THANK YOU