200 likes | 221 Views
Discover the benefits of incorporating competitive programming and the UVa Online Judge in the classroom, fostering problem-solving skills and algorithm understanding. Prepare students for programming competitions effectively. Dive into a world of enriched learning experiences!
E N D
The Appropriateness of Competitive Programming and the UVa Online Judge in the Classroom Richard P. Simpson Midwestern State University
Competitive Programming Competitive programming is a mind sport usually held over the Internet or a local network, involving participants trying to program according to provided specifications. Contestants are referred to as sport programmers
Catagories • Short Term (1 to 5 hours) • ACM-ICPC • TopCoder • IOI (secondary schools) • many others • Long Term ( days to months) • CodeChef • and others
Training Resources • UVa Online Judge • SPOJ • others Roll your own • DOMjudge • Here you can develop your own problems (which are consequently new to the web!)
In the Classroom • Students need considerable more practice with general problem solving. • Students get a lot more work with STL • Once a student has a bag of tricks, selecting the appropriate algorithm for a problem forces complexity considerations. • The variety of ways students solve a particular problem results in interesting classroom discussions. (Efficiency!)
Faculty Resource • The Uva online judge is a wonderful resource for problems of every imaginable type. • Great for weekend projects which covers a specific topic. • Run time interest is created!! • Many problems force the student to handle all the corner cases. • A great resource with problems for YOU to solve.
Programming Team Preparation • First started using the Uva Judge to prepare for the ACM programming contest. • meet once a week to work on these problems. • This forced me to start solving many of these problems as well.
A full course • Developed a course that has students solve 2 to 3 problems a week. • Allows the study of algorithms that do not naturally appear in our usual course sequence. • Reminds students of algorithms they should already know (but forgot) • Many problems are of the type that are asked in interviews.
Comment on Cheating • Solutions to most of these problems can be found on the web • This can be partly addressed by requiring a certain approach or DS be used. • Most students are serious about learning to be a better programmer/problem solver. • I am not going to punish the good students by excessively worrying about cheating. • Exams will level the playing field.
UVa online judge • UVa Online Judge is an online automated judge for programming problems hosted by University of Valladolid. • Contains over 4300 problems which is constantly being expanded. • A user may submit a solution in ANSI C (C89), C++ (C++98), Pascal, Java, C++11 or Python.
Let go to the UVa Judge • https://uva.onlinejudge.org/ • Create an account if you do not already have one. • Login • Click on Browse problems
Browse Problems click here
Solving and Submission • All problems must read from stdin and write to stdout • Only one file is submitted and it must have no non-library includes • You may write your solution and test it using your favorite IDE such as • visual studio c++ in windows • code::blocks in Linux • or even the cloud application repl.it
Redirect I/O in the IDE When you execute the program in your IDE you would like it to read from a data file when your program performs input. cin<< x<<y<<endl; Need to configure your IDE to do this by modifying the command line parameters i.e. add <data.dat Of course you can do everything at the command line and not worry about this.
Lets solve a trivial problem • Uva 11172 Relational Operators • Open up your IDE • Create a data file called data.dat • Copy and paste the example data into this file • Redirect the I/O (set the command line params) • Write code to read in the data and write out the data. ( Do this for every problem you attempt) • Now solve the problem on your local machine
Possible results • AC - accepted • WA – wrong answer • PE – presentation error • CE – compilation error • TLE - Time limit exceeded
I use the uHunt interface look at students submissions
Debugging • There are several things one can do to help in debugging problems • use Uva’s debug for interesting test data and run checks. • UVa toolkit • read the discussions • Watch for extra lines, extra spaces at the end of a line, numerical precision etc.