reactive and output-only hkoi training team 2006 liu chi man (cx) 11 feb 2006
TRANSCRIPT
![Page 1: Reactive and Output-Only HKOI Training Team 2006 Liu Chi Man (cx) 11 Feb 2006](https://reader030.vdocument.in/reader030/viewer/2022020320/5697bfc11a28abf838ca4347/html5/thumbnails/1.jpg)
Reactive and Output-OnlyReactive and Output-OnlyHKOI Training Team 2006
Liu Chi Man (cx)11 Feb 2006
![Page 2: Reactive and Output-Only HKOI Training Team 2006 Liu Chi Man (cx) 11 Feb 2006](https://reader030.vdocument.in/reader030/viewer/2022020320/5697bfc11a28abf838ca4347/html5/thumbnails/2.jpg)
2HKOI Training Team 2006
Outline
• Reactive tasks (a.k.a. interactive tasks)
• Output-only tasks (a.k.a. open test data tasks)
• Scoring methods
![Page 3: Reactive and Output-Only HKOI Training Team 2006 Liu Chi Man (cx) 11 Feb 2006](https://reader030.vdocument.in/reader030/viewer/2022020320/5697bfc11a28abf838ca4347/html5/thumbnails/3.jpg)
3HKOI Training Team 2006
Traditional tasks
• Read input, write output
• Static input
• Problem: Add Two Numbers• Input: Two integers per line• Output: For each input line, add the two integers
and output the sum on one line
![Page 4: Reactive and Output-Only HKOI Training Team 2006 Liu Chi Man (cx) 11 Feb 2006](https://reader030.vdocument.in/reader030/viewer/2022020320/5697bfc11a28abf838ca4347/html5/thumbnails/4.jpg)
4HKOI Training Team 2006
Add Two Numbers
• Algorithm One• while not end of input do
read integers from input
write sum to output
• Algorithm Two• read all integers into an array
compute all sums
write all sums to output
![Page 5: Reactive and Output-Only HKOI Training Team 2006 Liu Chi Man (cx) 11 Feb 2006](https://reader030.vdocument.in/reader030/viewer/2022020320/5697bfc11a28abf838ca4347/html5/thumbnails/5.jpg)
5HKOI Training Team 2006
Interactivity
• Problem: Guess The Number• My lucky number is an integer between 1 and N• Guess until you get the correct answer• After each guess I will tell you whether your guess
is too big or too small or correct
![Page 6: Reactive and Output-Only HKOI Training Team 2006 Liu Chi Man (cx) 11 Feb 2006](https://reader030.vdocument.in/reader030/viewer/2022020320/5697bfc11a28abf838ca4347/html5/thumbnails/6.jpg)
6HKOI Training Team 2006
Interaction via provided libraries
• Function calls
• Examples:• N := GetN(); / N = GetN();• MakeGuess(7);
• Task description contains sufficient instructions
• Using a library• Pascal: uses mylib;• C/C++: #include "mylib.h"
![Page 7: Reactive and Output-Only HKOI Training Team 2006 Liu Chi Man (cx) 11 Feb 2006](https://reader030.vdocument.in/reader030/viewer/2022020320/5697bfc11a28abf838ca4347/html5/thumbnails/7.jpg)
7HKOI Training Team 2006
Interaction via standard I/O
• I/O method same as traditional tasks
• IMPORTANT• Make sure you read and write in the correct order
specified in the task description
![Page 8: Reactive and Output-Only HKOI Training Team 2006 Liu Chi Man (cx) 11 Feb 2006](https://reader030.vdocument.in/reader030/viewer/2022020320/5697bfc11a28abf838ca4347/html5/thumbnails/8.jpg)
8HKOI Training Team 2006
Nature of reactive tasks
• Black-box testing
• Two-person games
• Updates and queries
![Page 9: Reactive and Output-Only HKOI Training Team 2006 Liu Chi Man (cx) 11 Feb 2006](https://reader030.vdocument.in/reader030/viewer/2022020320/5697bfc11a28abf838ca4347/html5/thumbnails/9.jpg)
9HKOI Training Team 2006
Black-box testing
• Use queries to reveal hidden information
• Examples include• Guess The Number• Mastermind
![Page 10: Reactive and Output-Only HKOI Training Team 2006 Liu Chi Man (cx) 11 Feb 2006](https://reader030.vdocument.in/reader030/viewer/2022020320/5697bfc11a28abf838ca4347/html5/thumbnails/10.jpg)
10HKOI Training Team 2006
Two-person games
• Write a program to play a game against the judging program
• Examples include• Tic-tac-toe• Nim (match-picking)
![Page 11: Reactive and Output-Only HKOI Training Team 2006 Liu Chi Man (cx) 11 Feb 2006](https://reader030.vdocument.in/reader030/viewer/2022020320/5697bfc11a28abf838ca4347/html5/thumbnails/11.jpg)
11HKOI Training Team 2006
Updates and queries
• Processing of a set of data
• “Update” command• Modify the set of data
• “Query” command• Ask for some information about the data
• A Query must be answered before next command is revealed
![Page 12: Reactive and Output-Only HKOI Training Team 2006 Liu Chi Man (cx) 11 Feb 2006](https://reader030.vdocument.in/reader030/viewer/2022020320/5697bfc11a28abf838ca4347/html5/thumbnails/12.jpg)
12HKOI Training Team 2006
Strategies
• Black-box testing• Bisection, trisection, etc.
• Two-person games• Minimax method (dynamic programming speed up)
• Updates and queries• More advanced data structures, e.g. disjoint sets
![Page 13: Reactive and Output-Only HKOI Training Team 2006 Liu Chi Man (cx) 11 Feb 2006](https://reader030.vdocument.in/reader030/viewer/2022020320/5697bfc11a28abf838ca4347/html5/thumbnails/13.jpg)
13HKOI Training Team 2006
Output-only tasks
• All input test cases are given to you
• You are required to submit corresponding output files for these inputs
• No source code, executable required
• Usually optimal (best) answers are very difficult to obtain• Partial scoring
![Page 14: Reactive and Output-Only HKOI Training Team 2006 Liu Chi Man (cx) 11 Feb 2006](https://reader030.vdocument.in/reader030/viewer/2022020320/5697bfc11a28abf838ca4347/html5/thumbnails/14.jpg)
14HKOI Training Team 2006
Nature of output-only tasks
• “Hard” problems• Optimal solutions not likely to be found within
minutes• For the precise definition of “hardness”, look
forward to “[Talk] Introduction to Complexity Theory”
• “Semi-manual” problems• Some of the test cases designed for you to solve by
hand or wicked methods
![Page 15: Reactive and Output-Only HKOI Training Team 2006 Liu Chi Man (cx) 11 Feb 2006](https://reader030.vdocument.in/reader030/viewer/2022020320/5697bfc11a28abf838ca4347/html5/thumbnails/15.jpg)
15HKOI Training Team 2006
Strategies• Manual inspection of all test cases
• Make sure you don’t miss those easy inputs
• Go for suboptimal solutions• Greedy, heuristics, random, etc.
• Fully utilize your resources• Hours of CPU time• Plentiful memory• Other tools (calc, sort, factor, bc, graphics software,
games, etc.)
![Page 16: Reactive and Output-Only HKOI Training Team 2006 Liu Chi Man (cx) 11 Feb 2006](https://reader030.vdocument.in/reader030/viewer/2022020320/5697bfc11a28abf838ca4347/html5/thumbnails/16.jpg)
16HKOI Training Team 2006
Effort vs. Score
Effort
Score
![Page 17: Reactive and Output-Only HKOI Training Team 2006 Liu Chi Man (cx) 11 Feb 2006](https://reader030.vdocument.in/reader030/viewer/2022020320/5697bfc11a28abf838ca4347/html5/thumbnails/17.jpg)
17HKOI Training Team 2006
1 Task = 10 Tasks!
• Sometimes test cases are designed so that each one has some special properties
• Different properties may lead to different solving methods
• 1 task, T programs• T is the number of test cases
![Page 18: Reactive and Output-Only HKOI Training Team 2006 Liu Chi Man (cx) 11 Feb 2006](https://reader030.vdocument.in/reader030/viewer/2022020320/5697bfc11a28abf838ca4347/html5/thumbnails/18.jpg)
18HKOI Training Team 2006
Conclusion
• 1 to 2 per competition (6 tasks in total)
• Reactive tasks are more popular than output-only tasks
• In general, it is easier to score high marks in reactive tasks than output-only tasks
![Page 19: Reactive and Output-Only HKOI Training Team 2006 Liu Chi Man (cx) 11 Feb 2006](https://reader030.vdocument.in/reader030/viewer/2022020320/5697bfc11a28abf838ca4347/html5/thumbnails/19.jpg)
19HKOI Training Team 2006
Frequencies
React Output React Output
IOI’00 1 0 NOI’00 0 0
IOI’01 3 1 NOI’01 0 0
IOI’02 1 1 NOI’02 1 1
IOI’03 2 1 NOI’03 1 1
IOI’04 0 0 NOI’04 1 1
IOI’05 1 0 NOI’05 0 1
![Page 20: Reactive and Output-Only HKOI Training Team 2006 Liu Chi Man (cx) 11 Feb 2006](https://reader030.vdocument.in/reader030/viewer/2022020320/5697bfc11a28abf838ca4347/html5/thumbnails/20.jpg)
20HKOI Training Team 2006
Scoring methods
• How are marks given for each test case?
• All-or-nothing• Correct – full; incorrect – zero
• Partial• You may get something between full and zero
![Page 21: Reactive and Output-Only HKOI Training Team 2006 Liu Chi Man (cx) 11 Feb 2006](https://reader030.vdocument.in/reader030/viewer/2022020320/5697bfc11a28abf838ca4347/html5/thumbnails/21.jpg)
21HKOI Training Team 2006
Partial scoring
• Multiple parts• Example: If you get the first integer wrong, you get
0%; if you get the first integer correct, you get 30%; if you get both integers correct, you get 100%
• Suboptimal award• Example (maximization): Let A be the optimal
answer and B be your answer; your score is (B/A) 100%
![Page 22: Reactive and Output-Only HKOI Training Team 2006 Liu Chi Man (cx) 11 Feb 2006](https://reader030.vdocument.in/reader030/viewer/2022020320/5697bfc11a28abf838ca4347/html5/thumbnails/22.jpg)
22HKOI Training Team 2006
Partial scoring
• Number of queries (Reactive: black-box testing)• Fewer queries, higher score
• Usually an explicit formula for score calculation is given
• Some of the variables in the formula may be unknown to you, however• “Your answer is compared to our answer”• Our refers to the judges
![Page 23: Reactive and Output-Only HKOI Training Team 2006 Liu Chi Man (cx) 11 Feb 2006](https://reader030.vdocument.in/reader030/viewer/2022020320/5697bfc11a28abf838ca4347/html5/thumbnails/23.jpg)
23HKOI Training Team 2006
Relative scoring
• Your answer is compared to the best answer among all contestants• If nobody else attempts that task, you win