programming assignment tutorial - postech

22
Programming Assignment Tutorial [CSED331] Algorithm course Chanyang Seo, Dahye Jeong, Seungjun Lee Contact: [email protected]

Upload: others

Post on 24-Dec-2021

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Programming Assignment Tutorial - POSTECH

Programming Assignment Tutorial

[CSED331] Algorithm course

Chanyang Seo, Dahye Jeong, Seungjun Lee

Contact: [email protected]

Page 2: Programming Assignment Tutorial - POSTECH

Programming Assignment

• You will take 7-8 programming assignments. (3~5 problems for each assignment)

• Problems are originated on the lectures.

• Language: any of C/C++/python, no others.• You will have 1 or 2 week(s) per assignment.

• We also have programming mid-term and final exam.• You can use all the materials on domjudge site at exam.

Page 3: Programming Assignment Tutorial - POSTECH

Introduction of Domjudge

• Domjudge system• https://domjudge.postech.ac.kr/• Submit your code at here.• Real-time evaluation.

• Click “Domjudge”

Page 4: Programming Assignment Tutorial - POSTECH

Registration

• Click “Login” and “Register now”

Page 5: Programming Assignment Tutorial - POSTECH

Registration

• Make your Own ID• After making your ID, please let us know which ID is yours by answering Google sheet below.

• https://forms.gle/ALZmhzj5tQiCrusA6

<- Fill the same name as Username

Page 6: Programming Assignment Tutorial - POSTECH

Domjudge Home

• After logging in① Links to main page

② Select assignments you will solve. Now you will face sample contest “assn0”.

① ②

Page 7: Programming Assignment Tutorial - POSTECH

Problem Text

① “Problemset” button will lead you to this page.② You can access each problem text here.

Page 8: Programming Assignment Tutorial - POSTECH

How to Submit Your Program

• Submit button will show you the submission form.① Select source file② Select problem③ Select language (important!)

Page 9: Programming Assignment Tutorial - POSTECH

Submission Results

• You can check your submission results from home

Page 10: Programming Assignment Tutorial - POSTECH

Submission Results

• There will be these results:• PENDING: The system is evaluating your program. Wait and press F5 to

check your result. If it takes too long, ask us.• COMPILER-ERROR: There was an error during compilation of your code.

You can see the error message.• RUN-ERROR: There was an error during running your program. You should

check whether there was index out of range, stack overflow, wrong input format, etc.

• NO-OUTPUT: There was no output from your program.• WRONG-ANSWER: Output of your program doesn’t match with the answer.• TIMELIMIT: Your program failed to be terminated in timelimit. Write more

efficient program.• TOO-LATE: Your submission was posted after the end of deadline.• CORRECT: Correct answer!

Page 11: Programming Assignment Tutorial - POSTECH

Read Problem Carefully!

• Otherwise, you can solve WRONG problem.• Or, you solve the problem in wrong way.

• Problem statement guides time complexity you should achieve.

• Also, you should keep the input/output statement.

Page 12: Programming Assignment Tutorial - POSTECH

Time Complexity in Problem Solving

• The maximum size of input gives you the hint of optimal time complexity.

• Table shows the scale of computation corresponding to time complexity and size of input.

O(n^3) O(n^2) O(n lg n)(approx.)

100 1,000,000x 10,000x 1,650x

1000 100,000,000x 1,000,000x 16,500x

10000 1e+12x 100,000,000x 165,000x

100000 1e+15x 10,000,000,000x 1,650,000x

3GHz = 3,000,000,000 instructions / second

In 1 second?

Loose

Very tight

Impossible

Page 13: Programming Assignment Tutorial - POSTECH

Usual Errors

• Compiler version: gcc/g++ 7.5.0, python 3.6.9• Index out of range: check the size of array(list).• Memory exceed: you cannot use memory larger than 512MB• Segmentation fault: similar to ‘index out of range’

• Occurred in dynamic memory allocation

• (Python3) Maximum recursion depth exceed: add bellow• import sys• sys.setrecursionlimit([number])

Page 14: Programming Assignment Tutorial - POSTECH

Notice about grading

• Assn0 is not scored for testing purposes. • All problems are 1 point. • There’s no partial score.

• If you got ‘Correct’ once, you get 1 point.• Otherwise, you get no points at all.

Page 15: Programming Assignment Tutorial - POSTECH

Notice about Plagiarism- Copy Checking• DO NOT COPY code from your friend, senior or internet!• We will use automatic copy checker program to detect plagiarism. We can ask you some explanation if your implementation has high similarity with any other implementation.

• Note that cheating is great violation according to POSTECH regulation!

• WE DON’T CARE WHO IS SOURCE AND WHO IS RECEIVER.• We are the master copy checker :P

Page 16: Programming Assignment Tutorial - POSTECH

Let’s Practice!

• Click problem 1 in “assn1” contest.

• It defines the goal of program, input/output style and time limit.

• You should satisfy all described statements.

• Luckily, we provide you a solution for this tutorial problem.

Page 17: Programming Assignment Tutorial - POSTECH

Let’s Practice!

• Copy the solution and paste it to your local file and save

• Then, submit the file to Domjudge system!

• (Note that we used “long long” type in C/C++ for this problem. Do not make a mistake using small data type that doesn’t cover the given input range)

Page 18: Programming Assignment Tutorial - POSTECH

Clarification

• You will encounter numerous problems during the assignment.

• You can leave question to TAs at the system.

• You can ask any topic related to the programming assignments.

• But, do not ask us about any specific test case!

Page 19: Programming Assignment Tutorial - POSTECH

Clarification

• How?

Page 20: Programming Assignment Tutorial - POSTECH

Notice about attendance(Q&A session)

• Regular Q&A session are held every Monday at 9:30am.• WebEx attendance history will be counted and reported at the "Attendance" tab within 1 week.

• Participation time >=90%: attendance• Participation time >=80%: tardiness• Participation time <80%: absent

• If you miss more than a quarter(1/4) of attendance, you will get F.

• First-week attendance will not be counted because of course correction.

Page 21: Programming Assignment Tutorial - POSTECH

Notice about attendance(VOD)

• Week VODs are available on Monday.• Online-attendance is calculated automatically when you watch VOD.

• If you miss more than a quarter(1/4) of attendance, you will get F.

• First-week attendance will not be counted because of course correction.

• Due to the technical problem, VOD for next week(Divide-and-Conquer3) was uploaded this week. You have to watch this video next week even you have watched this week.

Page 22: Programming Assignment Tutorial - POSTECH

Notice about handwriting homework

• Answer must be written by hand in English.• You get 0 points for the problem if you write the answer in Korean.

• Submission must be high-definition photo and pdf format with a single file.

• Points may be deducted if your handwriting is not readable clearly or wrong format.

• No late submission.