cgcgx / hustoj

Automatically exported from code.google.com/p/hustoj
0 stars 0 forks source link

The Last "\n #28

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by cn-...@china.com.cn on 8 Nov 2010 at 12:34

GoogleCodeExporter commented 9 years ago
发现OJ题目中很多题目都PE,原来是最后一行的\n的问题。
记得原来的HUSTOJ 
CORE是有几条语句处理这个的,即忽略最后有没有\n。
所以建议在所用的ZOJ的那部分评测代码后面也加上这样的机��
�。
毕竟因为最后一个换行总让人PE很不爽...

Original comment by cn-...@china.com.cn on 8 Nov 2010 at 12:36

GoogleCodeExporter commented 9 years ago
try r504 to see if it got your point

Original comment by newsc...@gmail.com on 10 Nov 2010 at 1:02

GoogleCodeExporter commented 9 years ago
I tried, it doesn't work, remained PE.
But when I switched to the original HUSTOJ core, everything became okay. 
I think you still have to fix this in ZOJ core (compare function), in another 
way...

Original comment by cn-...@china.com.cn on 10 Nov 2010 at 1:23

GoogleCodeExporter commented 9 years ago
can you upload a sample of this issue in FPS format

Original comment by newsc...@gmail.com on 10 Nov 2010 at 2:16

GoogleCodeExporter commented 9 years ago
try r508 ?

Original comment by newsc...@gmail.com on 10 Nov 2010 at 2:38

GoogleCodeExporter commented 9 years ago
r508 still didn't work, it can't forgive the last '\n' either. 

Original comment by cn-...@china.com.cn on 11 Nov 2010 at 4:44

Attachments:

GoogleCodeExporter commented 9 years ago
is there any miss understanding?
check my source
http://acm.sie.edu.cn/JudgeOnline/showsource.php?id=940

i've added
   printf("\n\n\n");
 before return 0;

it AC.

Original comment by newsc...@gmail.com on 11 Nov 2010 at 9:02

GoogleCodeExporter commented 9 years ago
Yes, you ACed because I switched to the original HUSTOJ comparition function...

Original comment by cn-...@china.com.cn on 11 Nov 2010 at 9:03

GoogleCodeExporter commented 9 years ago
When I use the ZOJ compare(), many problems PE...

Original comment by cn-...@china.com.cn on 11 Nov 2010 at 9:03

GoogleCodeExporter commented 9 years ago
i'm using the same data and r508 with ZOJ-compare.
i AC too.

Original comment by newsc...@gmail.com on 11 Nov 2010 at 9:05

GoogleCodeExporter commented 9 years ago
have you did what i recommanded in issue27 ?

Original comment by newsc...@gmail.com on 11 Nov 2010 at 9:06

GoogleCodeExporter commented 9 years ago
i mean

{{{
cd /home/judge/data
find . -name *.in -exec fromdos -d {} \;
find . -name *.out -exec fromdos -d {} \;
}}}

Original comment by newsc...@gmail.com on 11 Nov 2010 at 9:07

GoogleCodeExporter commented 9 years ago
No '\r\n' in those files...

Original comment by cn-...@china.com.cn on 11 Nov 2010 at 9:18

GoogleCodeExporter commented 9 years ago
I saw there's a function 
{{{
void delnextline(char s[]) {
    int L;
    L = strlen(s);
    while (L > 0 && (s[L - 1] == '\n' || s[L - 1] == '\r'))
        s[--L] = 0;
}
}}}
in the original HUST judge_client which can ignore all the \r or \n characters.

Original comment by cn-...@china.com.cn on 11 Nov 2010 at 9:31

GoogleCodeExporter commented 9 years ago
i dump your file into this demo,it works nice.

http://www.newsclan.com/JudgeOnline/problem.php?id=1104

Original comment by newsc...@gmail.com on 11 Nov 2010 at 9:33

GoogleCodeExporter commented 9 years ago
But all in all, I think since 

#define STD_MB 1048576 //10M Byte, I think
#define STD_F_LIM (STD_MB<<5)

so the limit output file size in HUSTOJ judge_client can reach 32MB, it's 
enough for any type of contests.

Original comment by cn-...@china.com.cn on 11 Nov 2010 at 9:35

GoogleCodeExporter commented 9 years ago
the r504 is ignore all space character

http://code.google.com/p/hustoj/source/browse/trunk/core/judge_client/judge_clie
nt.cc#175

Original comment by newsc...@gmail.com on 11 Nov 2010 at 9:36

GoogleCodeExporter commented 9 years ago
the memory alloc and free operation slow down the judger and there is some data 
bigger than 32m in my system

Original comment by newsc...@gmail.com on 11 Nov 2010 at 9:38

GoogleCodeExporter commented 9 years ago
But I tested, even the ZOJ_compare you modified could not ignore the '\n' 
characters (at least the last one), while the original HUSTOJ_compare can.

Original comment by cn-...@china.com.cn on 11 Nov 2010 at 9:39

GoogleCodeExporter commented 9 years ago
just try to make a PE for this 
http://www.newsclan.com/JudgeOnline/problem.php?id=1104
then i could find out what's really wrong.

Original comment by newsc...@gmail.com on 11 Nov 2010 at 9:40

GoogleCodeExporter commented 9 years ago
maybe you can upload your data file themselves here,not just FPS.
FPS export function can fix \r\n problem.

Original comment by newsc...@gmail.com on 11 Nov 2010 at 9:46

GoogleCodeExporter commented 9 years ago
Those are test data files of this problem in our OJ

Original comment by cn-...@china.com.cn on 11 Nov 2010 at 10:34

Attachments:

GoogleCodeExporter commented 9 years ago
zhblue@ibm:~/acm$ hexdump data1.out 
0000000 3733 302e 0d30 320a 3338 3936 332e 0d33
0000010 330a 3333 3133 312e 0d36 330a 3137 3539
0000020 392e 0d35 330a 3132 3232 362e 0d35 310a
0000030 3336 3839 372e 0d36 320a 3932 3031 322e
0000040 0d34 330a 3239 2e30 3030 0a0d 3337 3438
0000050 302e 0d30 330a 3432 3131 322e 0d30 310a
0000060 3337 3636 302e 0d32 390a 3034 2e32 3932
0000070 0a0d 3733 3637 2e39 3933 0a0d 3633 3035
0000080 2e38 3733 0a0d 3935 3331 302e 0d30 310a
0000090 3834 3138 302e 0d30 300a 302e 0d30 320a
00000a0 3933 3239 382e 0d36 310a 3239 3837 322e
00000b0 0d35 320a 3333 3933 352e 0d38 340a 3835
00000c0 3339 362e 0d39 310a 3036 3932 372e 0d30
00000d0 370a 3534 2e33 3031 0a0d 3232 3033 2e36
00000e0 3437 0a0d 3831 3834 2e36 3134 0a0d 3134
00000f0 3834 2e30 3631 0a0d 3531 3632 2e38 3234
0000100 0a0d 3633 3530 2e37 3234 0a0d 3333 3839
0000110 2e34 3138 0a0d 3333 3833 382e 0d31 360a
0000120 3437 2e33 3030 0a0d 3539 3436 322e 0d37
0000130 330a 3337 3135 342e 0d31 360a 3239 2e33
0000140 3030 0a0d 3332 3435 2e36 3635 0a0d 3134
0000150 3031 2e37 3832 0a0d 3333 3733 2e34 3234
0000160 0a0d 3233 3035 2e37 3938 0a0d 3132 3837
0000170 2e35 3135 0a0d 3333 3130 2e36 3630 0a0d
0000180 3533 3533 2e32 3432 0a0d 3633 3233 2e37
0000190 3635 0a0d 3932 3236 2e37 3037 0a0d 3331
00001a0 3939 2e30 3339 0a0d 3235 3438 2e31 3430
00001b0 0a0d 3031 3433 2e39 3030 0a0d 3931 3631
00001c0 2e37 3038 0a0d 3837 3433 342e 0d38 300a
00001d0 302e 0d30 310a 3038 3936 342e 0d38 320a
00001e0 3932 3833 372e 0d35 320a 3732 3739 332e
00001f0 0d34 330a 3430 3534 392e 0d38 300a 302e
0000200 0d30 310a 3136 3633 372e 0d32 320a 3538
0000210 3536 332e 0d38 310a 3438 3139 382e 0d34
0000220 330a 3531 3738 312e 0d37 320a 3031 3039
0000230 392e 0d39 310a 3731 3235 372e 0d35 310a
0000240 3836 3937 332e 0d36 330a 3034 3333 322e
0000250 0d34 340a 3335 3733 312e 0d38 330a 3037
0000260 3538 302e 0d30 300a 302e 0d30 320a 3731
0000270 3033 322e 0d30 320a 3137 3737 302e 0d39
0000280 360a 3938 2e32 3633 0a0d 3539 3632 392e
0000290 0d35 320a 3535 3934 312e 0d30 320a 3834
00002a0 3036 392e 0d34 310a 3333 3831 322e 0d38
00002b0 320a 3530 3533 372e 0d32 320a 3332 3635
00002c0 372e 0d32 320a 3039 3538 332e 0d35 320a
00002d0 3932 3739 352e 0d30 310a 3734 3336 342e
00002e0 0d30 310a 3732 3930 332e 0d38 320a 3233
00002f0 3233 312e 0d35 320a 3635 3336 382e 0d37
0000300 310a 3139 3732 362e 0d31 390a 3837 302e
0000310 0d30 330a 3234 3534 392e 0d36 310a 3239
0000320 3334 342e 0d32 310a 3135 3237 352e 0d35
0000330 320a 3838 3433 312e 0d36 330a 3432 3930
0000340 302e 0d36 310a 3538 3934 362e 0d30 380a
0000350 3731 2e34 3030 0a0d 3732 3639 2e31 3136
0000360 0a0d 3233 3232 2e36 3434 0a0d 3132 3631
0000370 2e31 3036 0a0d 3632 3231 2e36 3337 0a0d
0000380 3631 3233 2e35 3631 0a0d 3133 3934 372e
0000390 0d31 330a 3534 3733 302e 0d31 330a 3932
00003a0 3030 372e 0d35 330a 3630 3639 382e 0d39
00003b0 360a 3735 2e38 3030 0a0d 3831 3631 2e30
00003c0 3832 0a0d 3834 3133 2e38 3331 0a0d 3632
00003d0 3533 2e32 3734 0a0d 0a0d               
00003da
---------------
0a0d=\r\n
zhblue@ibm:~/acm$ ls -l
总计 24
-rw-r--r-- 1 zhblue zhblue 11236 2010-11-11 21:07 data1.in
-rw-r--r-- 1 zhblue zhblue   986 2010-11-11 21:13 data1.out
-rw-r--r-- 1 zhblue zhblue    34 2010-11-11 21:07 sample.in
-rw-r--r-- 1 zhblue zhblue     7 2010-11-11 21:07 sample.out

zhblue@ibm:~/acm$ fromdos -d data1.out

986=>883

0000000 3733 302e 0a30 3832 3633 2e39 3333 330a
0000010 3333 3133 312e 0a36 3733 3931 2e35 3539
0000020 330a 3132 3232 362e 0a35 3631 3933 2e38
0000030 3637 320a 3932 3031 322e 0a34 3933 3032
0000040 302e 0a30 3337 3438 302e 0a30 3233 3134
0000050 2e31 3032 310a 3337 3636 302e 0a32 3439
0000060 3230 322e 0a39 3733 3637 2e39 3933 330a
0000070 3536 3830 332e 0a37 3935 3331 302e 0a30
0000080 3431 3838 2e31 3030 300a 302e 0a30 3332
0000090 3939 2e32 3638 310a 3239 3837 322e 0a35
00000a0 3332 3333 2e39 3835 340a 3835 3339 362e
00000b0 0a39 3631 3230 2e39 3037 370a 3534 2e33
00000c0 3031 320a 3332 3630 372e 0a34 3831 3834
00000d0 2e36 3134 340a 3431 3038 312e 0a36 3531
00000e0 3632 2e38 3234 330a 3036 3735 342e 0a32
00000f0 3333 3839 2e34 3138 330a 3333 2e38 3138
0000100 360a 3437 2e33 3030 390a 3635 2e34 3732
0000110 330a 3337 3135 342e 0a31 3936 3332 302e
0000120 0a30 3332 3435 2e36 3635 340a 3131 3730
0000130 322e 0a38 3333 3733 2e34 3234 330a 3532
0000140 3730 382e 0a39 3132 3837 2e35 3135 330a
0000150 3033 3631 302e 0a36 3533 3533 2e32 3432
0000160 330a 3336 3732 352e 0a36 3932 3236 2e37
0000170 3037 310a 3933 3039 392e 0a33 3235 3438
0000180 2e31 3430 310a 3330 3934 302e 0a30 3931
0000190 3631 2e37 3038 370a 3338 2e34 3834 300a
00001a0 302e 0a30 3831 3630 2e39 3834 320a 3932
00001b0 3833 372e 0a35 3232 3937 2e37 3433 330a
00001c0 3430 3534 392e 0a38 2e30 3030 310a 3136
00001d0 3633 372e 0a32 3832 3635 2e35 3833 310a
00001e0 3438 3139 382e 0a34 3133 3835 2e37 3731
00001f0 320a 3031 3039 392e 0a39 3131 3537 2e32
0000200 3537 310a 3836 3937 332e 0a36 3433 3330
0000210 2e33 3432 340a 3335 3733 312e 0a38 3733
0000220 3830 2e35 3030 300a 302e 0a30 3132 3337
0000230 2e30 3032 320a 3137 3737 302e 0a39 3836
0000240 3239 332e 0a36 3539 3632 392e 0a35 3532
0000250 3435 2e39 3031 320a 3834 3036 392e 0a34
0000260 3331 3133 2e38 3832 320a 3530 3533 372e
0000270 0a32 3232 3533 2e36 3237 320a 3039 3538
0000280 332e 0a35 3232 3939 2e37 3035 310a 3734
0000290 3336 342e 0a30 3231 3037 2e39 3833 320a
00002a0 3233 3233 312e 0a35 3532 3636 2e33 3738
00002b0 310a 3139 3732 362e 0a31 3739 2e38 3030
00002c0 330a 3234 3534 392e 0a36 3931 3432 2e33
00002d0 3234 310a 3135 3237 352e 0a35 3832 3338
00002e0 2e34 3631 330a 3432 3930 302e 0a36 3831
00002f0 3435 2e39 3036 380a 3731 2e34 3030 320a
0000300 3937 3136 362e 0a31 3233 3232 2e36 3434
0000310 320a 3131 3136 362e 0a30 3632 3231 2e36
0000320 3337 310a 3336 3532 312e 0a36 3133 3934
0000330 372e 0a31 3433 3335 2e37 3130 330a 3932
0000340 3030 372e 0a35 3033 3936 2e36 3938 360a
0000350 3735 2e38 3030 310a 3138 3036 322e 0a38
0000360 3834 3133 2e38 3331 320a 3336 3235 342e
0000370 0a37 000a                     

Original comment by newsc...@gmail.com on 11 Nov 2010 at 1:20

GoogleCodeExporter commented 9 years ago
data used on www.newsclan.com
-rw-r--r-- 1 vu2207 vu2207    28 2010-11-11 17:29 sample.in
-rw-r--r-- 1 vu2207 vu2207     5 2010-11-11 17:29 sample.out
-rw-r--r-- 1 vu2207 vu2207 10121 2010-11-11 17:29 test0.in
-rw-r--r-- 1 vu2207 vu2207   882 2010-11-11 17:29 test0.out

Original comment by newsc...@gmail.com on 11 Nov 2010 at 1:42

GoogleCodeExporter commented 9 years ago
if you don't want to fix these test data from windows plantform.
r509 should give you compatibility.

Original comment by newsc...@gmail.com on 11 Nov 2010 at 11:20

GoogleCodeExporter commented 9 years ago

Original comment by newsc...@gmail.com on 16 Jul 2011 at 3:06