RagnarGrootKoerkamp / BAPCtools

Tools for developing ICPC-style programming contest problems.
GNU General Public License v3.0
49 stars 22 forks source link

bt generate: sort by variable name #319

Closed thorehusfeldt closed 11 months ago

thorehusfeldt commented 11 months ago

I would like this:

               VALIDATORS               |           PROBLEM STATEMENT
           1 <=    N     <= 10          |              1 <= N <= 10               en,da
           0 <=   d_A    <= 120         |            1 <= t_A <= 120              en,da
           0 <=   d_B    <= 120         |            0 <= d_A <= 120              en,da
           1 <=   t_A    <= 120         |            1 <= t_B <= 120              en,da
           1 <=   t_B    <= 120         |            0 <= d_B <= 120              en,da

to be sorted.

mpsijm commented 11 months ago

I was having the same thought when validating the limits for BAPC. :smile: I was still doubting whether I wanted both to be sorted by alphabetical order (as in the left column), or by "order in the input statement" (as in the right column) :thinking: The former is easier to implement, while the latter feels more natural if some variables are dependent on earlier variables.

thorehusfeldt commented 11 months ago

The latter makes a lot of sense to me. Very good point.

RagnarGrootKoerkamp commented 11 months ago

(I agree this would be nice, but not invested enough myself to implement it right now, so I'll leave this for one of you to implement.)

thorehusfeldt commented 11 months ago

Please try to bt constraint a few problems with commit 7ec4b43 and tell me how that worked out.

mpsijm commented 11 months ago

I tried it on the BAPC problems, and it looks very nice! :smile: I also notice the gaps in case there are no matching variables, that makes it really easy to spot inconsistencies :slightly_smiling_face: For example, for King of the Hill, we used a in the validator but v in the statement:

               VALIDATORS               |           PROBLEM STATEMENT            
           1 <=    n     <= 10000       |            1 <= n <= 10000              en
           1 <=    x     <= 10000       |             1 <= x,y <= n               en
                                        |          1 <= v <= 1000000000           en
           1 <=    a     <= 1000000000  |      

And for International Irregularities, we renamed p to r in the problem statement, but did not update the validator:

               VALIDATORS               |           PROBLEM STATEMENT            
           2 <=    n     <= 100000      |            2 <= n <= 100000             en
           1 <=    q     <= 100000      |            1 <= q <= 100000             en
           0 <=    m     <= 1000000000  |          0 <= m <= 1000000000           en
           0 <=    t     <= 1000000000  | 0 <= r_1 <= \dots <= r_n <= 1000000000  en
                                        |         0 <= t_i <= 1000000000          en
                                        |             1 <= x, y <= n              en
                                        |                 x != y                  en
           0 <=    p     <= 1000000000  |                                        
           1 <=    xy    <= 100000      | 

Thanks for implementing, I think this issue can be closed now :smile: