My submission (8764478) goes wrong on the following tests, but it has an AC on the judge system. The right answer for all test cases below is "equal". RRGB GRBR RRGY GRYR RRBG BRGR RRBY BRYR RRYG YRGR RRYB YRBR RGRB BRGR RGRY YRGR RGBR GRBR RGYR GRYR RBRG GRBR RBRY YRBR RBGR BRGR RBYR BRYR RYRG GRYR RYRB BRYR RYGR YRGR RYBR YRBR GRGB BGRG GRGY YGRG GGBR BGRG GGBY BGYG GGYR YGRG GGYB YGBG GBRG BGRG GBGY YGBG GBYG BGYG GYRG YGRG GYGB BGYG GYBG YGBG BRBY YBRB BGBY YBGB BBYR YBRB BBYG YBGB BYRB YBRB BYGB YBGB 1 2 3 4 1 3 4 2 1 4 2 3 2 4 3 1 2 3 1 4 2 1 4 3 3 2 4 1 3 4 1 2 3 1 2 4 4 2 1 3 4 1 3 2 4 3 2 1 Edited by author 14.08.2015 23:03 I know AC solution, that won't pass this test: RGBR BGRR Also test BGRR RGBR may be added. Edited by author 29.08.2010 05:26 I got WA#35)). But this tests helped me to get AC. Thanks.) Edited by author 26.02.2014 22:35 Edited by author 26.02.2014 22:35 We can just rotate our second diamond and compare it to the first diamond. Like this: for(int i=0;i<4;i++) {for(int j=0;j<3;j++) {if(a==b) {cout<<"equal"<<endl;return 0;} // Rotate diamond around current base-face string x=e+b[2]+b[3]+b[1]; b=b[0]+x;} string t="abcd"; // Change base-face if(i!=2) {t[0]=b[1];t[1]=b[3]; t[2]=b[2];t[3]=b[0];} else {t[0]=b[2];t[1]=b[1]; t[2]=b[3];t[3]=b[0];} b=t;} Please give any tests. I tried some but my program succesfully done them.. test case : RGBY RGBY answer : equal Var a,b:array [0..3] of string; c,d:string[4]; N,I,J:LongInt; P:Boolean; Begin Readln(C); Readln(D); P:=FALSE; A[0]:=C[1];A[1]:=C[2];A[2]:=C[3];A[3]:=C[4]; B[0]:=D[1];B[1]:=D[2];B[2]:=D[3];B[3]:=D[4]; If A[0]=B[0] Then If ((A[1]=B[1]) and (A[2]=B[2]) and (A[3]=B[3])) or ((A[1]=B[3]) and (A[2]=B[1]) and (A[3]=B[2])) or ((A[1]=B[2]) and (A[2]=B[3]) and (A[3]=B[1])) Then P:=True; If A[0]=B[2] Then If ((A[1]=B[1]) and (A[2]=B[3]) and (A[3]=B[0])) or ((A[1]=B[3]) and (A[2]=B[0]) and (A[3]=B[1])) or ((A[1]=B[0]) and (A[2]=B[1]) and (A[3]=B[3])) Then P:=True; If A[0]=B[3] Then If ((A[1]=B[1]) and (A[2]=B[0]) and (A[3]=B[2])) or ((A[1]=B[2]) and (A[2]=B[1]) and (A[3]=B[0])) or ((A[1]=B[0]) and (A[2]=B[2]) and (A[3]=B[1])) Then P:=True; If P=True Then Writeln('equal') Else Writeln('different'); End. Say me why this program not work? Edited by author 01.12.2007 21:32 Edited by author 01.12.2007 21:33 Strange. Can you give me some test data for my C++ program? if ((sir[0]==sir1[1] && sir[1]==sir1[0] && sir[2]+sir[3]==sir1[2]+sir1[3]) || ((sir[3]==sir1[1] && sir[2]==sir1[0]) && (sir[0]==sir1[2] && sir[1]==sir1[3]))) cout <<"equal"; else { if (sir[0]==sir1[2] && sir[1]==sir1[3] && sir[3]==sir1[1] && sir[2]==sir1[0] ) cout <<"equal"; else { if (sir[0]==sir1[1] && sir[1]==sir1[3] && sir[2]==sir1[2] && sir[3]==sir1[0]) cout <<"equal"; else { if (sir[0]==sir1[0] && sir[1]==sir1[1] && sir[2]==sir1[2] && sir[3]==sir1[3]) cout <<"equal"; else { if (sir[3]==sir1[0]&&sir[2]==sir1[1]&&sir[1]==sir1[2]&&sir[0]==sir1[3]) cout <<"equal";
else cout <<"different"; } } } } My code seems legit. Tnx. All tests posted on the Forum (Discuss work for my program) Again working. Edited by author 15.03.2012 17:12 Edited by author 15.03.2012 17:24 Here: sir[2]==sir1[3] && sir[3]==sir1[2] YGBR GBRY should be different. :D sir[0]==sir1[1] && sir[1]==sir1[0] RRRR RRGG your algorithm's output is equal. :) (sir[3]=sir1[0]&&sir[2]=sir1[1]&&sir[1]=sir1[2]&&sir[0]=sir1[3]) - is equal Try it: RGBY YBGR I'm not sure it's right, but you can try. :) please,somebody! take me tests!!! wa on 1st test :/ but work on all my tests GRBY YGBR equal BBGY GYBB equal YGBR GBRY different BYRG GYRB different Why WA#12?????? This my code: import java.util.Scanner; public class T_1433 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s_1 = sc.next(); String asos = s_1.substring(0,1);// tetraedr asosi String left = s_1.substring(1,2);// tetraedr chap tamoni String right = s_1.substring(2,3);// tetraedr o'ng tamoni String back = s_1.substring(3,4);// tetraedr orqa tamoni String s_2 = sc.next(); // 2-tetraedr... boolean equal = false; //-------------------------- if(asos.equals(s_2.substring(0,1))){ if(left.equals(s_2.substring(1,2)) && right.equals(s_2.substring(2,3))&& back.equals(s_2.substring(3,4))) equal = true; if(left.equals(s_2.substring(2,3)) && right.equals(s_2.substring(3,4))&& back.equals(s_2.substring(1,2))) equal = true; if(left.equals(s_2.substring(3,4)) && right.equals(s_2.substring(1,2))&& back.equals(s_2.substring(2,3))) equal = true; } //---------------------------- asos = s_1.substring(1,2); left = s_1.substring(3,4); right = s_1.substring(0,1); back = s_1.substring(2,3); if(asos.equals(s_2.substring(0, 1))){ if(left.equals(s_2.substring(1,2)) && right.equals(s_2.substring(2,3))&& back.equals(s_2.substring(3,4))) equal = true; if(left.equals(s_2.substring(2,3)) && right.equals(s_2.substring(3,4))&& back.equals(s_2.substring(1,2))) equal = true; if(left.equals(s_2.substring(3,4)) && right.equals(s_2.substring(1,2))&& back.equals(s_2.substring(2,3))) equal = true; } //------------------------------ asos = s_1.substring(2,3); left = s_1.substring(0,1); right = s_1.substring(3,4); back = s_1.substring(1,2); if(asos.equals(s_2.substring(0, 1))){ if(left.equals(s_2.substring(1,2)) && right.equals(s_2.substring(2,3))&& back.equals(s_2.substring(3,4))) equal = true; if(left.equals(s_2.substring(2,3)) && right.equals(s_2.substring(3,4))&& back.equals(s_2.substring(1,2))) equal = true; if(left.equals(s_2.substring(3,4)) && right.equals(s_2.substring(1,2))&& back.equals(s_2.substring(2,3))) equal = true; } //-------------------------------- asos = s_1.substring(3,4); left = s_1.substring(2,3); right = s_1.substring(1,2); back = s_1.substring(0,1); if(asos.equals(s_2.substring(0, 1))){ if(left.equals(s_2.substring(1,2)) && right.equals(s_2.substring(2,3))&& back.equals(s_2.substring(3,4))) equal = true; if(left.equals(s_2.substring(2,3)) && right.equals(s_2.substring(3,4))&& back.equals(s_2.substring(1,2))) equal = true; if(left.equals(s_2.substring(3,4)) && right.equals(s_2.substring(1,2))&& back.equals(s_2.substring(2,3))) equal = true; } if(equal)System.out.println("equal"); else System.out.println("different"); } } program timus; var a,b,c:string; procedure solving; var i,j:longint; check:boolean; d:char; begin check:=false; c:=''; c:=c+b[1]+b[2]+b[3]+b[4]; for i:=1 to 4 do begin d:=c[2]; c[2]:=c[3]; c[3]:=c[4]; c[4]:=d; if c=a then check:=true; end; c:=''; c:=c+b[2]+b[3]+b[1]+b[4]; for i:=1 to 4 do begin d:=c[2]; c[2]:=c[3]; c[3]:=c[4]; c[4]:=d; if c=a then check:=true; end; c:=''; c:=c+b[3]+b[1]+b[2]+b[4]; for i:=1 to 4 do begin d:=c[2]; c[2]:=c[3]; c[3]:=c[4]; c[4]:=d; if c=a then check:=true; end; c:=''; c:=c+b[4]+b[2]+b[3]+b[1]; for i:=1 to 4 do begin d:=c[2]; c[2]:=c[3]; c[3]:=c[4]; c[4]:=d; if c=a then check:=true; end; if check=true then writeln('equal') else writeln('different'); end; begin readln(a); readln(b); SOLVING; end. c:=c+b[4]+b[2]+b[1]+b[3]; I got WA at test18, can somebody give some test or hint, please? There is some strange algo, but AC. let we have two arrays of char[5]; Then we compare first diamond with SOME permutations of second, but that permutations is 1234 1342 1423 2143 2314 ... i.e. we miss two permutations of lexicographic sequence of all permutations, the take two, then miss two again. int compare_condition = 1; while (1) { if (compare_condition < 2) compare(diamond1, diamond2); if (eq){ cout << "equal" << endl; return 0; } compare_condition++; compare_condition %= 4; if (!next_permutation(p.begin(), p.end())) break; } This code works, but why??? Can anybody prove it??? Strange algo, isn't??? ATTENTION, PEOPLE! IT IS WRONG !!! Edited by author 18.12.2007 21:12 can you dive me test for WA#13 here is the code #include<string.h> #include<iostream.h> main () { bool p=true; char a[4], b[4], d[4], e[4], t; int r1=0, g1=0, b1=0, y1=0, r2=0, g2=0, b2=0, y2=0, kol=0, k=0, c[4]={0,0,0,0}, i, j; for (i=0; i<4; i++) cin>>a[i]; for (i=0; i<4; i++) cin>>b[i]; for (i=0; i<4; i++) { if (a[i]=='R') r1++; else if (a[i]=='G') g1++; else if (a[i]=='B') b1++; else y1++; if (b[i]=='R') r2++; else if (b[i]=='G') g2++; else if (b[i]=='B') b2++; else y2++; } if (r1!=r2 || g1!=g2 || b1!=b2 || y1!=y2) cout<<"different"; else { for (i=0; i<4; i++) if (a[i]==b[i]) { c[i]=1; kol++; } if (kol>=3) cout<<"equal"; else if (kol==2) { if (r1>=3 || g1>=3 || b1>=3 || y1>=3) cout<<"equal"; else if (r1==2 || g1==2 || b1==2 || y1==2) { for (i=0; i<4; i++) if (c[i]==1) d[k++]=a[i]; if (d[0]==d[1]) cout<<"different"; else cout<<"equal"; } else cout<<"different"; } else if (kol==1) cout<<"equal"; else { k=0; for (i=0; i<4; i++) if (c[i]==0) { d[k]=a[i]; e[k++]=b[i]; } for (i=0; i<4; i++) { t=d[0]; d[0]=d[3]; d[3]=d[2]; d[2]=d[1]; d[1]=t; for (j=0; j<4; j++) if (d[j]!=e[j]) p=false; if (p) { cout<<"equal"; return 0; } else p=true; } if (d[1]==e[2] && d[2]==e[1]) cout<<"equal"; else if (d[0]==e[3] && d[3]==e[0]) cout<<"equal"; else cout<<"different"; } } return 0; } RBRY RYRB equal Thank you, now I've got AC. But test 13 is RGBY YRGB different who can bring me some tests?thank you very much ! Me to wa 16 WA#32 such as RGBY GRYB => `egual` 26 such as RGBY BYRG => eq 16 such as RGBY YBGR => eq [code deleted] Edited by author 23.12.2006 01:27 TRY THIS FUCKIN TEST: RRRR BBBB your function check() - leads to infinite recursion... Hmm... Thank's... (З мене пиво:)) ;-) Two beers, if you tell me, why fuckin:) WA6... Edited by author 23.12.2006 01:49 I don't know what you changed in your source... I added the function, that calculate number of faces in both Diamonds: [code deleted] Edited by author 23.12.2006 02:36 Test for you: RGYB RBYG the answer must be "different", but your program writes "equal"... I suggest you to make a diamond from paper and check all your rotating procedures. Some of them (at least two: back & full_rotate) are incorrect... Hint (solution :-) ): you have to rotate the first diamond with all possible ways (there are only 12 ways) and every time check if it is equal to second one. 2x0.5 or 1.00 litr? Maybe, it will tomorrow:) I don't drink beer before the contest. And after the contest I will be drinking vodka! :-) Vodka is good, but beer it's beer. In beer we beer-beer I'm going crazy.I've remade my program in that way, what you tell me, but Now I have WA13...:(( Edited by author 24.12.2006 00:45 function q(a,b,c,d,e,f,g,h:char):boolean; begin if ((e=a) and (f=b) and (g=c) and (h=d)) or ............. {всевозможные перестановки граней 1-го тетраэдра} ............. or ((e=d) and (f=a) and (g=c) and (h=b)) then q:=true else q:=false; end; var a,b,c,d,e,f,g,h:char; x,y:string[4]; begin readln(x); readln(y); a:=x[1]; b:=x[2]; c:=x[3]; d:=x[4]; e:=y[1]; f:=y[2]; g:=y[3]; h:=y[4]; if ((q(a,b,c,d,e,f,g,h))=true) or ((q(a,b,c,d,e,g,h,f))=true) or ................ {всевозможные перестановки граней 2-го тетраэдра} ................ ((q(a,b,c,d,h,f,e,g))=true) or ((q(a,b,c,d,h,e,g,f))=true) then writeln('equal') else writeln('different'); end. Edited by author 27.11.2007 16:59 tnx Edited by author 26.04.2007 12:54 Edited by author 26.04.2007 12:54 Sorry I have deleted it... Edited by author 27.11.2007 16:58 who can bring me some tests?thank you very much ! Can i use strstr() or strcmp() or strcat() functions with or without "#include <string.h>"? |
|