10690 - Expression Again

All about problems in Volume 106. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

ahto
New poster
Posts: 1
Joined: Sun Aug 08, 2004 5:18 pm

10690 - Expression Again

Post by ahto »

It seems the input data for this problem is formatted a bit sloppily, having extra lines with spaces after the last number. This is a problem for Pascal users when they are not allowed to use the seekeof standard function (which, unlike the allowed eof function, skips over all whitespace before deciding whether there is something left to be read from the input).

In short term, it would be nice if judges would clean up the input for this problem.

In long term, it would be even nicer for them to allow seekeof and ioresult functions to give Pascal users a chance to handle future spurious spaces on their own.
liulike
Learning poster
Posts: 52
Joined: Wed Jul 30, 2003 10:56 am

10690

Post by liulike »

who can give me a hint?


Thank you very much!
UFP2161
A great helper
Posts: 277
Joined: Mon Jul 21, 2003 7:49 pm
Contact:

Post by UFP2161 »

DP
Minilek
Learning poster
Posts: 90
Joined: Tue Jul 27, 2004 9:34 am
Location: Cambridge, MA
Contact:

Post by Minilek »

[EDIT]
I think what I said before works but am not sure...let me code it
and submit and check to make sure. ^_^
[/EDIT]
Observer
Guru
Posts: 570
Joined: Sat May 10, 2003 4:20 am
Location: Hong Kong

Post by Observer »

This task is somewhat related to 10664 - Luggage. In both problems you need to divide a set of integers into 2, so... Think about it...

Also note that if you know the sum of a set after division, you gotta know that of the other one! (Sounds trivial doesn't it :P)

P.S. Are there trailing blank lines in the judge input? :-?
7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
Master
Learning poster
Posts: 82
Joined: Thu Oct 10, 2002 1:15 pm
Location: St. Johns, Canada
Contact:

10690

Post by Master »

i have tried to solve this problem a lot, but it gives WA

Any one can give some sample input and output

Thanks in advance
M H Rasel
CUET Old Sailor
Krzysztof Duleba
Guru
Posts: 584
Joined: Thu Jun 19, 2003 3:48 am
Location: Sanok, Poland
Contact:

Post by Krzysztof Duleba »

I haven't got AC yet, but I believe my answers for this input are correct.
Input:
10 2
-22 -10 40 5 -8 4 -42 17 -12 -1 41 48
4 4
-11 -15 -26 -6 16 0 -22 8
5 7
-31 -27 7 -25 8 6 -41 5 26 28 -30 23
9 4
-43 -27 3 -18 -12 27 -19 -10 16 31 -2 -10 22
1 3
10 5 -2 29
7 2
29 5 4 -32 -11 -3 7 -25 29
2 4
30 27 2 5 32 -13
10 2
-4 -12 -11 33 -11 -26 -1 30 -27 46 3 -43
6 5
39 5 -20 -10 10 -17 0 13 -42 12 -31
7 5
-3 43 -32 32 -6 1 -19 -17 -7 15 44 -16
5 1
4 28 -4 0 -31 -1
6 9
5 24 -23 -29 -8 -25 -29 -11 -15 -21 19 23 -4 -25 -14
8 4
-6 -16 12 -33 22 9 -13 -28 -17 5 -11 -41
4 5
9 18 -27 19 3 -21 24 24 8
6 10
1 20 5 11 16 3 27 -13 6 24 5 33 -1 -2 -24 25
7 3
32 34 26 20 -40 -2 -10 10 14 42
3 7
-23 -6 -35 5 -1 28 3 -37 -35 1
3 8
34 -14 -31 15 -3 4 11 20 37 12 25
9 10
18 10 0 14 18 -39 8 23 -16 20 21 -38 -1 23 -6 19 21 17 -5
2 5
-2 -8 18 -5 35 -14 -7
6 2
-10 -26 -1 15 25 -42 31 46
1 10
-14 30 -18 7 -17 -34 -8 47 5 4 43
9 6
-28 -6 -14 18 -7 -16 -15 -18 -23 -41 1 -20 15 -1 -2
6 8
33 -22 -2 -2 -33 4 12 9 -6 -27 -1 43 9 12
4 10
15 -9 12 -25 -7 -20 -9 -10 -2 -2 9 -30 22 43
2 9
0 8 48 -3 5 25 -25 -18 -21 29 29
2 8
-19 -4 -24 13 16 5 -33 30 -5 -47
4 2
8 -27 3 12 32 17
7 1
3 -19 -24 18 10 13 8 -6
1 8
-25 -44 4 -21 -5 18 8 -14 -3
6 8
26 -7 24 13 3 19 -37 -31 12 3 -38 -13 3 -17
1 2
-6 -32 1
7 8
-5 -27 -31 -12 32 -18 -9 -9 30 9 -5 34 15 11 -16
8 9
32 -10 16 10 0 -4 9 -15 -31 1 6 -7 5 1 38 -31 4
8 10
23 8 -21 18 38 7 39 -3 -3 7 -2 -10 -24 -7 -7 -21 -11 -18
7 10
5 -5 -28 24 8 2 33 20 -28 -15 26 6 15 -2 -4 -15 7
6 2
-30 13 -40 -12 28 -32 23 0
8 10
4 16 -15 -10 -2 -7 12 -15 -30 2 -2 16 18 -19 19 -6 -17 11
9 2
-7 9 10 10 18 23 -32 -5 13 -7 13
7 7
1 0 -8 15 -5 5 8 -12 -9 -32 36 14 7 30
8 2
29 19 25 -44 33 7 -10 35 30 17
5 10
3 -6 -9 37 -28 -32 23 -33 -12 -26 -40 31 1 26 4
9 8
-7 -15 2 21 -44 42 -15 31 1 30 6 27 -35 -2 25 15 3
9 1
-41 -7 17 8 -35 16 11 3 -6 -14
6 1
39 14 -26 31 40 10 -7
5 3
-34 -25 -35 13 12 -13 -18 17
8 4
-44 -17 6 -15 22 31 -4 7 -18 13 -46 -4
9 5
2 -28 -5 -28 5 -14 -8 -11 15 0 10 15 10 -23
4 8
-5 -16 -15 2 -2 11 -2 14 1 21 -24 1
6 1
11 -17 12 48 4 8 14
5 8
-40 5 -11 6 -8 10 9 5 -32 20 38 26 -2
4 2
-7 18 2 5 -24 1
6 6
-7 28 -9 -26 -32 27 -16 19 -26 16 50 -34
8 4
2 5 12 -37 6 -12 18 26 32 39 18 -10
1 6
-1 -16 29 29 32 33 -14
4 4
-43 -9 13 -44 11 16 15 9
8 3
-34 38 -4 -21 -41 -11 34 -29 -29 -7 22
4 3
39 -7 19 20 -4 14 -31
8 2
1 -28 -10 -36 -13 4 -5 41 -8 30
9 5
1 -11 -5 -1 23 -22 -20 -1 -35 29 23 2 -9 18
3 3
-1 -27 11 17 -21 -34
4 8
-12 -1 22 31 -7 1 11 33 14 -12 25 30
9 2
-7 -1 -28 21 -1 12 14 18 19 10 31
8 7
27 -12 -37 -5 -7 -16 -18 7 8 29 29 12 -23 -14 -10
8 4
35 23 -34 19 -12 34 -33 -37 -21 10 -11 -19
1 2
0 37 -36
4 9
2 4 10 -29 -18 -34 35 2 25 -3 39 -10 13
5 3
-41 -8 10 2 -30 -16 14 -25
6 9
-19 11 -14 26 3 -9 -13 8 -28 -8 12 -7 27 6 7
4 7
-1 10 10 -31 -8 12 40 -24 -32 1 5
5 4
-31 -19 10 22 -6 -5 -4 -4 -2
3 5
6 -43 -6 -22 12 -1 16 33
2 4
1 -28 -20 -1 -1 -6
2 10
17 -1 4 21 36 18 -1 -13 -26 -5 -3 -12
3 4
-8 7 48 -12 -22 41 -45
2 7
26 -3 -31 13 48 -39 -24 -37 32
1 10
17 -16 -3 -3 -30 5 -23 -15 -7 13 13
10 6
1 -11 -10 17 -10 18 -3 24 -1 23 44 -13 -10 11 -1 29
3 2
4 29 -2 -32 41
1 8
-35 -4 15 21 20 8 -9 -14 -30
3 4
-16 21 28 18 13 -4 49
4 3
-2 14 26 39 -12 15 33
7 8
43 18 -26 20 19 27 24 1 26 0 21 -10 25 10 -3
1 10
-26 -7 -16 -5 35 -28 35 46 24 -24 1
8 10
-12 9 -4 4 19 23 20 5 4 1 14 9 -12 18 14 29 2 6
7 9
-11 3 8 -21 -25 -8 -23 -40 -11 -28 15 44 -31 -44 -20 -5
5 2
18 24 11 21 6 -2 -5
6 8
-20 -13 -17 13 -28 -35 24 23 -2 -43 -17 9 22 8
4 2
-14 9 -11 37 37 25
10 4
12 -5 20 21 47 -14 -30 9 15 10 33 -13 9 36
7 1
-36 -8 23 21 13 4 26 -8
5 2
-18 -28 14 30 -3 -1 13
2 9
-33 29 -35 33 30 -21 -7 -5 -7 4 -24
7 9
45 -33 -20 8 -7 11 15 -26 -37 -5 26 -2 22 2 3 -1
7 10
-21 -3 -6 8 17 23 -15 -8 5 -5 -12 -14 -22 7 -22 -5 34
1 3
-4 2 29 -7
6 8
-5 -19 9 -28 -11 35 -1 5 -8 2 -8 -16 11 -14
6 3
14 -17 10 -3 -7 -19 -9 -6 -40
4 4
37 21 7 -1 3 42 8 -20
6 10
4 -7 12 10 35 5 4 -38 13 -36 -44 5 -2 -30 4 22
Output:
900 -7936
783 -1332
650 -15862
441 -13248
377 -88
2 -3420
1702 -1034
132 -8058
420 -9480
306 -13500
3 -896
4422 -11328
3422 -7920
812 -3478
4624 -6192
3968 -9256
2491 -4896
3024 -7584
2862 -16878
70 -1908
360 -7208
450 -2686
6162 -4550
210 -11132
42 -9660
1480 -5658
1156 -5244
500 -1656
0 -648
1672 -1800
400 -14729
186 -38
0 -16002
144 -11737
42 -17250
600 -14162
621 -5151
156 -12054
506 -3276
625 -7475
4964 -10530
930 -22022
1806 -23000
476 -1105
2440 -3302
1722 -5250
1190 -10366
900 -6325
49 -2976
1536 -1649
169 -11067
6 -806
25 -19019
2450 -8892
1947 -1728
231 -4785
1681 -16544
624 -3864
144 -6745
16 -9785
744 -2214
4556 -5344
1935 -4305
225 -14659
529 -17427
0 -1332
324 -11557
2209 -3120
1 -8463
81 -7315
380 -1690
4 -4686
756 0
306 -2886
18 -8352
56 -7600
598 -1122
2916 -9405
351 -2516
196 -1029
2970 -812
3192 0
9506 -2050
264 -1764
5550 -1932
9702 -11178
1330 -560
1444 -17325
1702 -2700
5625 -13144
294 -2556
10 -2438
323 -6237
0 -17030
380 -11830
36 -261
576 -6649
1482 -2058
2350 -1188
462 -17898
Last edited by Krzysztof Duleba on Sat Aug 14, 2004 12:26 pm, edited 1 time in total.
Master
Learning poster
Posts: 82
Joined: Thu Oct 10, 2002 1:15 pm
Location: St. Johns, Canada
Contact:

Post by Master »

I think u'r output is not correct

(I am not sure. I may be mis understand the problems)

some of the last output of your given input gives nevative numbers for the minimum but there is no negative number in the input . would u pls explain this.

Thanks
M H Rasel
Per
A great helper
Posts: 429
Joined: Fri Nov 29, 2002 11:27 pm
Location: Sweden

Post by Per »

Actually, they are completely wrong. :)
For starters, you can't get negative values unless there are negative numbers in the input. Here's my AC output for your input.

Code: Select all

14400 1225
2704 1975
16512 10192
14400 5375
493 88
5124 966
2964 714
14062 972
9900 5994
13806 6496
1147 0
18906 12426
11342 5642
5852 4370
11664 3383
13224 4576
7568 845
10608 3384
25122 18480
1978 574
9504 2035
8460 892
12656 6014
11556 4584
11556 3900
10318 624
9280 1683
2450 968
1848 294
4312 417
15129 8405
224 38
17292 12180
12100 5376
17822 9812
14762 6572
7632 1992
12210 7788
5060 1620
8281 5032
13430 3944
24180 6624
25760 13770
4797 465
5080 1120
6970 4902
12882 4326
7569 3080
3249 648
3168 440
11236 4836
812 162
21025 18321
11772 4462
3993 153
6400 4956
17741 5456
4488 2725
7623 855
10000 1900
3080 2378
9900 3580
6077 320
16129 11773
20720 12272
1332 0
12544 2343
5329 2520
9801 6201
7569 2385
2652 1320
4828 1638
812 110
5890 310
8370 4212
14442 3792
3450 426
12769 5200
2867 612
4235 608
5550 3828
4970 3164
18632 12932
9246 246
10506 5950
28392 16836
1890 560
18769 13144
4402 2260
18769 7953
3708 540
2842 412
10880 1971
17292 6580
12882 7332
377 80
7396 4147
3906 1744
4830 2280
18360 5928
Krzysztof Duleba
Guru
Posts: 584
Joined: Thu Jun 19, 2003 3:48 am
Location: Sanok, Poland
Contact:

Post by Krzysztof Duleba »

Sorry, I used wrong file. Now it should be correct.
Master
Learning poster
Posts: 82
Joined: Thu Oct 10, 2002 1:15 pm
Location: St. Johns, Canada
Contact:

Post by Master »

Per thanx for ur output, But Krzysztof Duleba have changed his input .
I m struggling with this problem. So give some i/o to debug.
Thanks
M H Rasel
Krzysztof Duleba
Guru
Posts: 584
Joined: Thu Jun 19, 2003 3:48 am
Location: Sanok, Poland
Contact:

Post by Krzysztof Duleba »

The only difference between my input sets is that the first one missed sign information. If you want it back, just ignore sign and Per's output will be right. If you want more input, I can produce some - I still have my input generator and code (now accepted).
mohiul alam prince
Experienced poster
Posts: 120
Joined: Sat Nov 01, 2003 6:16 am
Location: Dhaka (EWU)

Post by mohiul alam prince »

Hi per
For starters, you can't get negative values unless there are negative numbers in the input.
Can you explain this line? I am getting WA in this problem.
My output is same as Krzysztof Duleba's output.

Thanks
MAP
AlexanderXXX
New poster
Posts: 1
Joined: Mon Jul 25, 2005 6:15 am

Post by AlexanderXXX »

I get WA with the output of Krzysztof Duleba's and Per's both....weird
Krzysztof Duleba
Guru
Posts: 584
Joined: Thu Jun 19, 2003 3:48 am
Location: Sanok, Poland
Contact:

Post by Krzysztof Duleba »

For the input set I presented (let's say it is stored in file input1), my output is correct. However, if you edit input1 and erase all '-' characters (almost all editors have "replace all" option that will do the job) and save the result in input2, then Per's output will be right.

Sorry for confusion. This is all because originally I posted the input without sign information, but my output was for the signed version. Per replied while it was still unsigned.
Post Reply

Return to “Volume 106 (10600-10699)”