Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
数据..对着数据debug 虽然ac了成就感大减 -___- 慎用 4 2 // sample input 1 2 2 3 4 1 6 2 5 3 // prosecution > defense 13 11 3 17 15 20 6 13 17 9 8 5 // prosecution < defense 3 5 17 16 6 0 17 10 6 14 3 19 4 13 0 17 8 4 // prosecution == defense 19 18 5 9 0 9 5 0 4 4 16 9 4 15 20 5 2 1 // two solutions with diffence 1, but one of them 1 2 // has a larger value (version 1) 4 3 2 1 // two solutions with diffence 1, but one of them 4 3 // has a larger value (version 2) 1 2 2 1 // two solutions with diffence 1, but one of them 3 4 // has a larger value (version 3) 1 2 2 1 // two solutions with diffence 1, but one of them 2 1 // has a larger value (version 4) 3 4 18 7 // only differences +1,0,-1 occur with diffenent 1 1 // sums (of values). Make sure that we are really 1 2 // selecting the maximum sum. 2 1 10 10 11 10 10 11 7 7 7 8 8 7 14 14 14 15 15 14 4 4 4 5 5 4 19 19 19 20 20 19 21 13 // all possible pairs of equal values: (0,0),...(20,20) 20 20 // again, there are many solutions with difference 0, but 19 19 // we want the one with maximum total value! 18 18 14 14 13 13 5 5 4 4 3 3 12 12 10 10 9 9 8 8 17 17 16 16 15 15 7 7 6 6 11 11 2 2 1 1 0 0 10 10 // n = m 8 16 9 6 6 6 2 15 0 13 17 8 17 3 13 13 15 10 18 2 10 9 // n = m+1 12 13 16 17 2 7 1 9 5 7 10 9 9 8 9 19 2 10 3 19 10 8 // n = m+2 14 4 18 17 20 12 10 16 8 14 1 16 9 10 16 11 4 2 10 16 10 5 // partition problem: note that the values of 3 8 // both parties add up to 80. There exits a solution 15 8 // with diffence 0 iff the prosections values can be 11 8 // divided in two subsets with sum 40 each. This 7 8 // example shows how to reduce BI-PARTITION to this 1 8 // problem and therefore show its NP-completeness. 17 8 8 8 2 8 13 8 3 8 1 1 // now for the boundary test: first comes n=m=1 9 11 1 1 7 3 1 1 5 5 1 1 0 0 1 1 0 20 1 1 20 0 1 1 20 20 20 20 // now comes n=m=20. 0 0 // first 20 times (0,0), then (0,20), (20,0) and (20,20) 0 0 // finally a random sample 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 20 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 20 20 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7 20 10 1 14 17 11 13 3 5 19 19 1 16 4 18 9 1 13 3 7 16 6 3 1 20 4 5 6 13 6 8 10 9 11 11 0 7 12 15 200 20 // and now for maximum values: n = 200, m = 20. 0 0 // again a five test series as above 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 200 20 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 200 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 0 20 200 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 200 20 12 20 10 0 13 17 15 1 8 12 4 12 9 5 3 3 13 18 13 6 12 11 10 6 3 1 6 1 20 2 20 18 19 2 12 12 1 8 12 6 6 11 11 16 11 0 2 1 7 6 15 6 13 7 16 17 5 11 0 14 17 8 10 9 12 14 9 9 20 2 13 4 5 19 17 0 2 12 13 8 4 17 5 3 11 19 6 9 1 3 5 10 18 0 6 6 2 8 20 11 0 8 5 1 12 17 17 8 9 12 9 10 3 0 0 19 20 9 15 16 4 6 1 1 19 13 9 17 0 8 1 4 19 14 1 6 16 14 12 12 19 18 19 19 3 17 9 17 4 6 16 19 14 3 9 4 13 19 3 16 19 9 0 2 8 9 10 10 15 3 16 2 16 4 12 6 13 0 8 0 11 8 18 15 18 18 2 20 7 2 14 1 3 0 0 15 11 16 0 18 1 17 11 11 9 9 19 6 6 1 18 13 19 8 9 0 2 18 16 9 18 12 10 13 12 13 16 5 7 17 5 4 13 8 0 4 8 19 12 14 0 2 6 19 9 0 18 6 7 19 18 19 15 7 9 12 12 5 0 1 15 15 1 16 20 16 10 10 11 2 7 4 16 12 16 0 4 3 17 18 8 14 13 7 5 19 14 20 19 15 5 19 18 7 6 9 0 2 7 3 11 14 7 0 8 5 18 15 0 2 11 2 11 17 11 8 5 16 5 13 12 12 8 6 20 14 13 14 0 1 10 15 12 17 14 15 2 6 17 14 6 13 10 10 13 6 6 16 15 11 4 5 15 18 11 13 19 20 2 0 12 9 14 2 10 20 0 7 16 2 16 13 20 17 14 6 5 15 7 19 17 10 0 19 13 15 17 18 19 9 14 1 15 2 8 8 2 15 20 2 200 10 // and another large test, n=200,m=10 16 11 9 10 2 19 2 18 8 7 18 3 9 16 10 3 16 3 9 16 4 14 10 0 10 13 7 1 5 3 4 19 9 1 7 4 19 20 10 5 19 13 9 5 12 4 18 12 4 12 0 8 3 0 10 18 6 19 3 3 17 8 12 17 5 3 16 4 4 10 8 18 17 17 18 9 6 0 20 6 8 13 8 2 16 17 18 7 14 0 0 3 14 0 10 11 9 12 7 9 1 8 16 19 20 18 14 19 17 11 16 3 11 11 5 1 19 4 0 20 12 18 19 18 7 16 9 2 17 17 5 7 6 12 9 18 17 4 6 7 20 7 10 6 14 3 13 13 16 15 6 0 19 7 15 6 16 19 20 17 17 0 12 18 7 6 16 8 5 17 10 15 1 5 4 19 1 6 12 6 4 10 5 9 16 5 8 17 4 3 1 6 6 5 3 19 13 6 11 1 4 9 1 19 6 3 10 11 13 8 0 13 5 9 1 10 13 19 15 0 1 10 13 9 6 13 16 3 2 17 13 20 12 7 10 18 12 12 15 18 4 18 14 10 17 18 11 2 5 2 15 15 19 14 12 5 18 19 19 12 5 17 9 20 12 0 19 13 14 7 2 16 7 11 15 15 8 6 8 2 1 13 18 15 1 2 17 20 4 19 9 16 10 12 7 12 9 3 5 14 0 12 14 10 1 11 12 18 16 16 10 15 7 8 9 10 13 7 11 14 6 3 7 20 16 4 17 1 6 7 12 11 18 1 6 19 10 15 15 12 1 17 12 3 13 16 14 14 15 1 18 8 19 15 6 15 12 9 14 16 7 7 11 0 1 20 16 13 15 3 5 13 9 11 12 15 20 16 2 17 1 19 17 15 12 5 16 2 2 2 19 9 15 0 20 11 18 12 14 5 0 0 Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator