# Internet Problem Solving Contest

## Problem J – Judging programs

Each subproblem of this problem is to be solved separately. They both share the same principle: you are given a formal specification of a task and a set of programs. Each of those programs contains a function named solve that attempts to solve the given task. All programs are written in an easily-readable subset of Python, and shouldn’t contain any language-specific tricks or gotchas.

Your goal is to determine which of those programs correctly solve the given task. We consider a program correct if, for every valid input, the program terminates after a finite number of steps (even if that number of steps is huge) and the returned answer is correct.

### Easy subproblem J1

Given are two integers n and k (1 ≤ k ≤ n ≤ 100). The task in this subproblem is to compute the value of the binomial coefficient $n\choose k$. In other words, compute the number of ways in which we can choose a k-element subset of an n-element set. For example, for n = 10 and k = 2 we should compute the value 45. (Note that Python can handle arbitrarily large integers.)

The programs are stored in files named j1_01.py through j1_11.py. Each program contains a function solve that expects 2 parameters: the integers n and k.

The output file you submit as your solution to the easy subproblem J1 must contain exactly 11 whitespace-separated words. The i-th word of your output describes the i-th program j1_i.py. The word must be “good” if the program correctly solves all valid instances, or “bad” otherwise.

### Hard subproblem J2

Given is a simple connected undirected weighted graph. The task of this subproblem is to find the length of the shortest path between two given vertices of the graph.

The programs are stored in files named j2_01.py through j2_15.py. Each program contains a function solve that expects 5 parameters:

• n: the number of vertices in the graph (2 ≤ n ≤ 100). Vertices are numbered 0 through n − 1.
• m: the number of edges in the graph (n − 1 ≤ m ≤ n(n − 1)/2).
• edge_list: the list of all m edges of the graph. Each edge is a triple (p, q, w) where p and q are the vertices that are connected by the edge (p ≠ q) and w is a positive integer which denotes the edge length (1 ≤ w ≤ 1 000). Note that no two edges share the same pair {p, q}.
• start and end: the two distinct endpoints of the path we are looking for.

For your convenience, we also provide the files j2_sample.{in,out} and j2_read_input.py. The in file contains a sample instance, the out contains its correct solution. The third file contains the function read_input that loads an instance from standard input and parses it into arguments expected by solve.

The output file you submit as your solution to the hard subproblem J2 must contain exactly 15 whitespace-separated words. The i-th word describes the i-th program j2_i.py. The word must be one of “good”, “ones”, and “bad”. Here, “ones” means that the program is not correct in general, but it does correctly solve all instances with unit-length edges (i.e., ones where for each edge we have w = 1). Answer “bad” if neither “good” nor “ones” applies.

### Submission count limits and grader responses

If you make a submission that is syntactically correct but does not get all answers right, our grader will tell you how many programs were classified correctly.

Note that you can only make at most 7 submissions for the easy subproblem J1, and at most 10 submissions for the hard subproblem J2. Be careful.
{"ft_lang_label":"__label__en","ft_lang_prob":0.886709,"math_prob":0.9037349,"size":3344,"snap":"2022-40-2023-06","text_gpt3_token_len":800,"char_repetition_ratio":0.12305389,"word_repetition_ratio":0.046589017,"special_character_ratio":0.24342105,"punctuation_ratio":0.107669614,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99423885,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-02-01T19:34:46Z\",\"WARC-Record-ID\":\"<urn:uuid:82fd281b-c5ac-421f-8a7b-d185f8427303>\",\"Content-Length\":\"8785\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:412f166e-e8c5-4388-84b0-7d94c7b358ef>\",\"WARC-Concurrent-To\":\"<urn:uuid:5b5e70fa-653e-413d-b369-25f066bbc5e1>\",\"WARC-IP-Address\":\"158.195.86.162\",\"WARC-Target-URI\":\"https://ipsc.ksp.sk/2014/real/problems/j.html\",\"WARC-Payload-Digest\":\"sha1:ZWKJEAY7WHDRZX45ZNM3VTBQV65GKLZ6\",\"WARC-Block-Digest\":\"sha1:ONYGTCA23VDDZAJKCSQDGUSWFFX42YEL\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-06/CC-MAIN-2023-06_segments_1674764499949.24_warc_CC-MAIN-20230201180036-20230201210036-00157.warc.gz\"}"}