Common Board| Show all threads Hide all threads Show all messages Hide all messages | | Where is wrong?(the following 3 examples are wrong answers)I don't know | ECUST Multistar | 1059. Expression | 21 Feb 2002 19:22 | 5 | 1: var n,i:integer; begin read(n); writeln(0); for i:=1 to n do begin writeln('X'); writeln('*'); writeln(i); writeln('+'); end; end. 2: ECUST Multistar 21 Feb 2002 19:18 2: var n,i:integer; begin n:=1000; writeln(0); for i:=1 to n do begin writeln('X'); writeln('*'); if i>=1000 then begin writeln(i mod 10);writeln(i mod 100 div 10);writeln(i mod 1000 div 100);writeln(i div 1000);end; if (i<1000)and(i>=100) then begin writeln(i mod 10);writeln(i mod 100 div 10);writeln(i mod 1000 div 100);end; if (i<100)and(i>=10) then begin writeln(i mod 10);writeln(i mod 100 div 10); end; if i<10 then writeln(i); writeln('+'); end; readln; end. > 2: > var n,i:integer; > begin > n:=1000; > writeln(0); > for i:=1 to n do > begin > writeln('X'); > writeln('*'); > if i>=1000 then begin writeln(i mod 10);writeln(i mod 100 div > 10);writeln(i mod 1000 div 100);writeln(i div 1000);end; > if (i<1000)and(i>=100) then begin writeln(i mod 10);writeln(i mod > 100 div 10);writeln(i mod 1000 div 100);end; > if (i<100)and(i>=10) then begin writeln(i mod 10);writeln(i mod > 100 div 10); end; > if i<10 then writeln(i); > writeln('+'); > end; > readln; > end. 2: ECUST Multistar 21 Feb 2002 19:18 2: var n,i:integer; begin read(n); writeln(0); for i:=1 to n do begin writeln('X'); writeln('*'); if i>=1000 then begin writeln(i mod 10);writeln(i mod 100 div 10);writeln(i mod 1000 div 100);writeln(i div 1000);end; if (i<1000)and(i>=100) then begin writeln(i mod 10);writeln(i mod 100 div 10);writeln(i mod 1000 div 100);end; if (i<100)and(i>=10) then begin writeln(i mod 10);writeln(i mod 100 div 10); end; if i<10 then writeln(i); writeln('+'); end; end. 3: ECUST Multistar 21 Feb 2002 19:21 3: var n,i:integer; begin read(n); writeln(0); for i:=1 to n do begin writeln('X'); writeln('*'); if i>=1000 then begin writeln(i div 1000);writeln(i mod 1000 div 100);writeln(i mod 100 div 10);writeln(i mod 10);end; if (i<1000)and(i>=100) then begin writeln(i mod 1000 div 100);writeln(i mod 100 div 10);writeln(i mod 10);end; if (i<100)and(i>=10) then begin writeln(i mod 100 div 10);writeln (i mod 10); end; if i<10 then writeln(i); writeln('+'); end; end. | | Why do i get W/A ? | Costel::icerapper@k.ro | 1010. Discrete Function | 21 Feb 2002 18:48 | 5 | [code deleted] Edited by moderator 02.01.2020 18:50 [code deleted] Edited by moderator 02.01.2020 18:51 Have you thought about a possible overflow? [code deleted] Edited by moderator 02.01.2020 18:52 I'm not a Pascal expert (I use C), but may be you are using a 16-bit compiler and the array is too big? Anyway, if you think a bit more you will see that an array is unecessary. > program timus1010; > const > maxn=100000; > type > ta=array[1..maxn] of double; | | Can anybody give me Accepted-program. I've got Accepted but I think that judge isn't ok :-( | Nazarov Denis (nsc2001@rambler.ru) | | 21 Feb 2002 15:47 | 3 | JUDGE BUG: begin Halt; end. This code get AC!!! My program(Accepted)(I don't think that it's correct): {$A+,B-,D+,E+,F-,G-,I+,L+,N+,O-,P-,Q-,R-,S+,T-,V+,X+} Program t1103; Const MaxN = 5000; Eps = 1E-15; Var C : array[1..MaxN]of record X,Y : extended end; O : array[1..MaxN-2]of extended; Pos : array[1..MaxN-2]of integer; a,b,R : extended; N,i,j : longint; MinI,kI : longint; W : extended; np : boolean; Procedure Swap(Var A1,A2 : integer); Var t : integer; begin t:=A1; A1:=A2; A2:=t; end; Procedure Merge(left,middle,rigth : integer); Var Ileft,Irigth,Cur,i : integer; Tmp : array[0..MaxN+1]of integer; begin Ileft:=left; Irigth:=middle+1; Cur:=0; While True do begin Cur:=Cur+1; if O[Pos[Ileft]]<O[Pos[Irigth]] then begin Tmp[Cur]:=Pos[Ileft]; Ileft:=Ileft+1; end else begin Tmp[Cur]:=Pos[Irigth]; Irigth:=Irigth+1; end; if Ileft=middle+1 then begin for i:=Irigth to rigth do begin Cur:=Cur+1; Tmp[Cur]:=Pos[i]; end; break; end; if Irigth=rigth+1 then begin for i:=Ileft to middle do begin Cur:=Cur+1; Tmp[Cur]:=Pos[i]; end; break; end; end; for i:=1 to rigth-left+1 do Pos[left+i-1]:=Tmp[i]; end; Procedure MergeSort(left,rigth : integer); Var middle : integer; begin if rigth-left<=0 then exit; if rigth-left=1 then begin if O[Pos[left]]-O[Pos[rigth]]>Eps then Swap(Pos[left],Pos[rigth]); exit; end; middle:=(left + rigth) div 2; MergeSort(left,middle); MergeSort(middle+1,rigth); Merge(left,middle,rigth); end; Procedure Solve(x1,y1,x2,y2,x3,y3 : extended); Var t1,t2,t3,u1,u2,u3 : extended; begin t1:=2*(x1-x2); u1:=2*(x3-x2); t2:=2*(y1-y2); u2:=2*(y3-y2); t3:=x2*x2+y2*y2-x1*x1-y1*y1; u3:=x2*x2+y2*y2-x3*x3-y3*y3; if abs(t1)>Eps then begin if abs(u2-(u1*t2)/t1)<eps then begin np:=true; exit; end; b:=-(u3-(t3*u1)/t1)/(u2-(u1*t2)/t1); a:=-b*(t2/t1)-(t3/t1); end else begin b:=-t3/t2; a:=-(b*u2+u3)/u1; end; R:=sqrt(sqr(x1-a)+sqr(y1-b)); end; Function GetDist(x1,y1,x2,y2 : extended) : extended; begin GetDist:=Sqrt(Sqr(x1-x2)+Sqr(y1-y2)); end; Function Check(a1,a2,a3 : integer) : boolean; Var i,ls,gr,j : integer; d : extended; begin np:=false; Solve(C[a1].X,C[a1].Y,C[a2].X,C[a2].Y,C[a3].X,C[a3].Y); if np then begin Check:=false; exit; end; ls:=0; gr:=0; j:=0; for i:=1 to N do if (i<>a1)and(i<>a2)and(i<>a3) then begin d:=GetDist(a,b,C[i].X,C[i].Y); if d<R then ls:=ls+1 else gr:=gr+1; j:=j+1; end; if ls+gr<>n-3 then begin r:=0; d:=d/r; end; Check:=(ls=gr); end; begin Read(N); for i:=1 to N do Read(C[i].X,C[i].Y); MinI:=1; for i:=2 to N do if (C[i].Y<C[MinI].Y)or((C[i].Y=C[MinI].Y)and(C[i].X<C[MinI].X)) then MinI:=i; W:=-1; for i:=1 to N do if i<>MinI then begin if C[i].Y=C[MinI].Y then begin kI:=i; break; end; if abs(C[i].X-C[MinI].X)/(C[i].Y-C[MinI].Y)>W then begin W:=abs(C[i].X-C[MinI].X)/(C[i].Y-C[MinI].Y); kI:=i; end; end; a:=C[MinI].X; b:=C[MinI].Y; j:=0; for i:=1 to N do if i<>MinI then if i<>kI then begin j:=j+1; Pos[j]:=j; O[j]:=GetDist(a,b,C[i].X,C[i].Y); end; MergeSort(1,N-2); for i:=((N-2) div 2)+1 downto 1 do begin j:=i; if Check(MinI,kI,Pos[j]) then begin Writeln(C[MinI].X:0:0,' ',C[MinI].Y:0:0); Writeln(C[kI].X:0:0,' ',C[kI].Y:0:0); Writeln(C[Pos[j]].X:0:0,' ',C[Pos[j]].Y:0:0); Halt(0); end; j:=N-2-i+1; if Check(MinI,kI,Pos[j]) then begin W | | Compile error : This makes no sense. | asif | | 21 Feb 2002 15:33 | 2 | Your solution on C++ was compiled with the following errors: 143384 temp\143384(34) : error C2471: cannot update program database 'e:\judge\vc60.pdb' > Your solution on C++ was compiled with the following errors: > > 143384 > temp\143384(34) : error C2471: cannot update program > database 'e:\judge\vc60.pdb' > | | Why wrong answer?(problem 1176) | sillyboy | | 21 Feb 2002 11:44 | 1 | I got wrong answer in problem 1176. Please help me. Here is my program: type pp=^point; point=record a2:integer; n2:pp; end; var n,s,a,b,e:integer; p:pp; c,d:array[1..1000] of pp; f:array[1..1000] of boolean; procedure z(a1:integer); begin p:=d[a1]; while c[a1]^.n2<>nil do begin p^.n2:=c[a1]^.n2; p:=p^.n2; c[a1]^.n2:=c[a1]^.n2^.n2; a1:=p^.a2; end; p^.n2:=nil; end; procedure y(a1:integer); var b1:integer; begin f[a1]:=false; b1:=a1; while d[a1]^.n2<>nil do begin writeln(b1,' ',d[a1]^.n2^.a2); b1:=d[a1]^.n2^.a2; if f[b1] then y(b1); d[a1]^.n2:=d[a1]^.n2^.n2; end; end; begin assign(input,''); reset(input); assign(output,''); rewrite(output); readln(n,s); for a:=1 to n do begin new(c[a]); c[a]^.n2:=nil; new(d[a]); d[a]^.n2:=nil; end; for a:=1 to n do begin for b:=1 to n do begin read(e); if (a<>b)and(e=0) then begin new(p); p^.a2:=b; p^.n2:=c[a]^.n2; c[a]^.n2:=p; end; end; readln; end; z(s); for a:=1 to n do if c[a]^.n2<>nil then z(a); fillchar(f,sizeof(f),true); y(s); close(input); close(output); end. Thank you! | | What wrong with my solution??? | meoden | 1011. Conductors | 21 Feb 2002 10:11 | 2 | I don't understand. Can I help me? This is my code: {@judge_id: 14971CM 1011 Pascal} const maxx=20000; var p,q:real; x:longint; begin read(p,q); for x:=1 to maxx do if int(p*x/100)<>int(q*x/100) then break; write(x); end. > I don't understand. Can I help me? > This is my code: > > {@judge_id: 14971CM 1011 Pascal} > const > maxx=20000; > var p,q:real; > x:longint; > > begin > read(p,q); > for x:=1 to maxx do if int(p*x/100)<>int(q*x/100) then break; > write(x); > end. | | Any Romanian can tell me URL of your NOI or some other programing sites (in English) of your country ?(-) | Tran Nam Trung (trungduck@yahoo.com) | | 21 Feb 2002 09:25 | 1 | | | HEY ADMINS!!! COMP. ERROR ON C AND C++!!!!!!!(without reasson) (-) | Miguel Angel | | 21 Feb 2002 05:58 | 1 | | | What's the problem with Extended? | [SPbSU ITMO] Yuri Bedny | 1052. Rabbit Hunt | 21 Feb 2002 02:34 | 1 | Thist of all I sorry for my bad English. Please, help me to solve this problem! I don't understand why I get Crash(Access_Violation), then I use Extended type. And then I use Real Type, my program gets WA. The time of my program's work T~O(N^2), but it works very slow more than 1.7 second on WA test. Please, help me to know good alghorithm. Thanks. | | Tell me if this input is wrong: | Costel::icerapper@k.ro | 1010. Discrete Function | 21 Feb 2002 01:59 | 4 | 5 3 2 1 2 3 what should the output be? > 5 > 3 > 2 > 1 > 2 > 3 > > what should the output be? Why... it seems i didn't understand this problem... | | Are there any admins left on this server? WHAT IS WRONG WITH C/C++!!!!!!!!! | Algorist | | 21 Feb 2002 01:44 | 1 | Why can't we submit in C/C++? And when will we be able to? | | PLEASE, GIVE ME ANY HINT TO SOLVE PROBLEM 1103 ! ! ! ! ! ! ! ! ! ! ! | Nazarov Denis (nsc2001@rambler.ru) | | 21 Feb 2002 01:14 | 1 | | | PLEASE, GIVE ME ANY HINT TO SOLVE PROBLEM 1103 ! ! ! ! ! ! ! ! ! ! ! | Nazarov Denis (nsc2001@rambler.ru) | | 21 Feb 2002 01:14 | 1 | | | PLEASE, GIVE ME ANY HINT TO SOLVE PROBLEM 1103 ! ! ! ! ! ! ! ! ! ! ! | Nazarov Denis (nsc2001@rambler.ru) | | 21 Feb 2002 01:14 | 1 | | | 1007 | Turing@ZJU.acm | 1007. Code Words | 21 Feb 2002 00:32 | 1 | 1007 Turing@ZJU.acm 21 Feb 2002 00:32 #include <iostream.h> #include <string.H> #include <stdio.h> void Done1() ; void Done2() ; void Done3() ; int N ; char a[1010] ; int tot [2] ; long sum1 ; void main() { cin >> N ; char ss[1010] = "X" ; cin >> ss ; while ( ss[0] != 0 ) { sum1 = 0 ; tot[0]=0 ; tot [ 1] = 0 ; int ai = strlen ( ss ) ; for ( int i = 0 ;i < ai ;i ++ ) { if ( ss[i] =='0' ) tot[0] ++ ; else { tot[1] ++ ; sum1 += i + 1; } } strcpy ( a , ss ) ; if ( ai == N ) Done1 () ; else if ( ai == N-1 ) Done2 () ; else if ( ai == N+1 ) Done3 () ; ss[0] = 'X' ; ss[1] = 0 ; cin >> ss ; } } void Done1 () { if ( tot[0]==tot[1] || sum1 % ( N+1 ) == 0 ) cout << a << endl ; else if ( tot [0] == tot[1] -2 ) { for ( int i = 0 ; i < N ;i ++ ) { if ( a[i] == '1' ) { a[i] = '0' ; cout << a <<endl ; break ; } } } else if ( tot[0]==tot[1]+2 ) { for ( int i = 0 ; i < N ;i ++ ) { if ( a[i] == '0' ) { a[i] = '1' ; cout << a <<endl ; break ; } } } else { sum1 %= N+1 ; if ( a[ sum1-1 ] == '1' ) { a[sum1-1] = '0' ; cout << a <<endl ; } else if ( a[N+1-sum1-1]=='0' ) { a[N+1-sum1-1] ='1' ; cout << a <<endl ; } } } void Done2() //short { int ff = 0 ; if ( N%2==0 ){ if (tot[0]==tot[1]-1 ) { strcat ( a , "0" ) ; ff = 1; cout << a << endl ; } else if ( tot[0]==tot[1]+1 ) { strcat ( a , "1" ) ; ff =1 ; cout << a << endl ; } } if ( !ff ) { int sum1o = sum1 ; char ccc ; int iii ; strcat ( a , "0" ) ; for ( int i = N-1 ; i >= 0 ; i-- ) { if ( a[i] =='1' ) sum1o+= 1 ; if ( sum1o% (N+1) == 0 ) { iii = i ; ccc = '0' ; break ; } else if ( (sum1o+i+1)%(N+1) == 0 ) { iii = i ; ccc = '1' ; break ; } } if ( i>= 0 ) { for ( int j = N-1 ; j >= iii+1 ;j -- ) a[j] = a[j-1] ; a[iii]=ccc ; cout << a <<endl ; } } } void Done3() //long { int iii = -1 ; if ( N%2==0 ){ if (tot[0]==tot[1]-1 ) { for ( int i = 0 ;i <= N ; i ++ ) { if ( a [i ]=='1' ) { iii = i ; break ; } } } else if ( tot[0]==tot[1]+1 ) { for ( int i = 0 ;i <= N ; i ++ ) { if ( a [i ]=='0' ) { iii = i ; break ; } } } } if ( iii == -1 ) { int sum1o = sum1 ; for ( int i = N-1 ; i >= 0 ; i-- ) { if ( a[i+1] =='1' ) sum1o-= 1 ; int xx = sum1o ; if ( a[i] == '1' ) xx -= i +1 ; if ( xx% (N+1) == 0 ) { iii= i ; break ; } } } if ( iii != -1 ) { for ( int i = iii ;i <= N-1 ; i++ ){ a[i ] = a[i+1] ; } a[N ] = 0 ; cout << a <<endl ; } } | | Problems with the submission system | Vinicius Fortuna | | 20 Feb 2002 23:05 | 3 | Hey, there's a problem with the submition system. Everybody is getting Compilation Error. I received the following message: Your solution on C was compiled with the following errors: 142733 temp\142733(56) : error C2471: cannot update program database 'e:\judge\vc60.pdb' Admin, could you fix it? Thanks Vinicius Fortuna > Hey, there's a problem with the submition system. > Everybody is getting Compilation Error. > I received the following message: > > Your solution on C was compiled with the > following errors: > > 142733 > temp\142733(56) : error C2471: cannot update program database > 'e:\judge\vc60.pdb' > > Admin, could you fix it? > > Thanks > > Vinicius Fortuna I have this problem too I keep getting compilation error | | What's wrong with output using "cout"? When I changed it on "printf", I got AC | Osama Ben Laden | 1047. Simple Calculations | 20 Feb 2002 22:34 | 3 | I thought, that these 2 codes are equal: cout.precision(2); cout.setf(ios::showpoint || ios::fixed); cout<<res<<'\n'; OR printf("%0.2f",res); Can anybody explain it me. Maybe, something wrong with GNU C++? Well, it does not work always :)) I do not know why, but the truth is that on different PCs these do not work identically....... a BIG BUG But I had even a bigger problem. I submitted a solution of problem 1176 (in fact, I submitted four different solutions over 30 times ;) ), but I always got TL exceeded. I always used cin/cout. I changed cin to scanf() and cout to printf() and all was OK -> my solution got AC, having in mind that 1. When using CIN/COUT it worked over the time limit i.e. more than 2 secs 2. When I changed them to scanf/printf i got AC and my program worked 0.9 secs............ So-> I advice you -> always use printf, scanf and all the C stuff :)) C++ input/output has lots of bugs, and as it seems, it si quite slow............. | | why i get WA (+) help me please. | Badd | 1135. Recruits | 20 Feb 2002 20:07 | 4 | label loop; var stemp : array[1..30500] of char; n,l,first,last,now : longint; count : longint; yeah : boolean; begin count:=0; readln(n); for l:=1 to n do read(stemp[l]); readln; first:=1; last:=n; loop : while stemp[first]='<' do inc(first); while stemp[last]='>' do dec(last); now:=first; yeah:=true; while (now<last) do begin if (stemp[now]='>') then begin if stemp[now+1]='<' then begin stemp[now]:='<'; stemp[now+1]:='>'; now:=now+2; count:=count+1; yeah:=false; end else now:=now+1; end else now:=now+1; end; if yeah=false then goto loop; writeln(count); end. Read the problem carefully. The input string may contain line breaks. For example, this is a correct test: 4 >> < < I'm sure you'll get AC. Good luck! label loop; var stemp : array[1..30500] of char; n,l,first,last,now : longint; count : longint; yeah : boolean; begin count:=0; read(n); for l:=1 to n do repeat read(stemp[l]); until (stemp[l]='<') or (stemp[l]='>'); first:=1; last:=n; loop : while stemp[first]='<' do inc(first); while stemp[last]='>' do dec(last); now:=first; yeah:=true; while (now<last) do begin if (stemp[now]='>') then begin if stemp[now+1]='<' then begin stemp[now]:='<'; stemp[now+1]:='>'; now:=now+2; count:=count+1; yeah:=false; end else now:=now+1; end else now:=now+1; end; if yeah=false then goto loop; writeln(count); end. What is the answer - 0 or 4? | | Could anybody tell me the answer for these test cases? (+) | Michael_Rybak | 1177. Like Comparisons | 20 Feb 2002 09:46 | 2 | Here's the test: 3 '-' like '[a-c]' 'b-b' like '[ba-cb]' 'bbb' like '[ba-cb]' Could you explain me why can there be more than one '-' in template - like in the last test in the example: 'U' like '[^a-zA-Z0-9]' The answer should be YES, I suppose, because template doesn't have a format '^c1-c2', so we should check wether there's a symbol 'U' among symbols of string 'a-zA-Z0-9'. Or did I misunderstand the problem? Here's my code. Could anybody give me a test where it fails? [deleted by moderator] Edited by moderator 11.04.2004 01:44 > > [deleted by moderator] Edited by moderator 11.04.2004 01:45 | | Wrong Answer !!! | Yeo Kern Sin | 1083. Factorials!!! | 20 Feb 2002 07:39 | 1 | Given the definition "n!!...!=n(n-k)(n-2k)...(n mod k), if k doesn’t divide n, n!!...!=n(n-k)(n-2k)...k, if k divides n (There are k marks ! in the both cases)." when n = k what should be the answer? Should it be = n * k (cos k divides n) or just = n when k > n what should be the answer? Should it be = n * (n mod k) = n * n or just = n Anyone got any idea? |
|
|