Show all threads Hide all threads Show all messages Hide all messages | SPOILER. Hint | andreyDagger | 1125. Hopscotch | 16 Sep 2021 16:21 | 1 | Precalculate pythagorean tripples | HINT for WA2 | tiancaihb | 1125. Hopscotch | 2 Oct 2015 16:40 | 2 | The statement is poor. It says M*N, which is usually considered as M in x-axis and N in y-axis. But actually, for M=2,N=3 they mean xxx xxx (That can be infered from "The next M lines contain a matrix with nonnegative integer elements") And we can't understand that from Sample because it's a square! *** So,if you always get WA2,try to swap m,n. *** I changed scanf("%d %d",&m,&n) to scanf("%d %d",&n,&m) and got AC. Sorry for my poor English. Edited by author 15.08.2009 11:30 Edited by author 15.08.2009 11:31 Nevermind, i'm stupid... another hint for WA #2: when generate your numbers a^2+b^2=c^2, and then you invert things like (+3X, +4X) for X=1...while coordinates are valid, and then later you want to invert (+6X, +8X) — don't! Because you invert the same place once more. Edited by author 02.10.2015 16:50 | Im getting CRASH on test2. plz help | Ibragim Atadjanov | 1125. Hopscotch | 4 Jan 2015 14:55 | 2 | Edited by author 08.06.2009 19:23 me too UPD. Oh, I understood my problem. I misunderstood the statment. Actually, there are m rows and n colums. But i thought on the contrary. Edited by author 04.01.2015 15:04 | Test2 Crash | pmartynov | 1125. Hopscotch | 31 Dec 2012 04:18 | 1 | I've seen lots of guys crashed on test 2. Could anyone provide a hint for this test? | Hints for TL ( Don't read if u wanna think ) | ACSpeed - Nguyen Khac Tung | 1125. Hopscotch | 17 Dec 2011 09:58 | 1 | 1. Even number of changes does not change the color. For eg : B -> W -> B 2. Odd number of changes equals to 1, B->W and vice versa | It's very simple problem!!!! | Hakobyan Tigran(RAU 902) | 1125. Hopscotch | 1 Oct 2010 12:23 | 1 | Edited by author 01.10.2010 12:24 | Plz,are there any skills to solve it in TL? | SunMoonStar | 1125. Hopscotch | 16 May 2010 20:40 | 4 | It is easy. I just two array. for point(x,y) change these point: x+dx,y+dy x+dx,y-dy x-dx,y+dy x-dx,y-dy Then you will got AC in 0.031s. ########################################################## dx:array [0..52] of longint=(0,3,4,5,6,7,8,8,9,9,10,12,12,12,12,14,15,15,15,16,16,18,20,20,20,21,21,24,24,24,24,24,27,28,28,30,30,32,33,35,36,36,36,40,40,40,42,44,45,45,48,48,48); dy:array [0..52] of longint=(0,4,3,12,8,24,6,15,12,40,24,5,9,16,35,48,8,20,36,12,30,24,15,21,48,20,28,7,10,18,32,45,36,21,45,16,40,24,44,12,15,27,48,9,30,42,40,33,24,28,14,20,36); ########################################################## Edited by author 29.05.2004 08:52 Fuckie solution.. Just take check all points to can change it on every move. And it's not TLE !!! May be you make unnecessary changes (mod 2 just!!!) When you are reading the data input, take it by modulo 2. My solution with long long got TLE, but after processing ints by modulo 2, everything was ok. | This test can help you | Barsuk Alexey [Pskov] | 1125. Hopscotch | 25 Apr 2010 22:17 | 1 | 9 9 WWWWWWWWW WWWWWWWWW WWWWWWWWW WWWWWWWWW WWWWWWWWW WWWWWWWWW WWWWWWWWW WWWWWWWWW WWWWWWWWW 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 correct answer WBWWBWWBW BWWWBWWWB WWWWBWWWW WWWWBWWWW BBBBBBBBB WWWWBWWWW WWWWBWWWW BWWWBWWWB WBWWBWWBW | Where is my error ? I got WA . Can you help me ! Pls | Ursachi Ionut | 1125. Hopscotch | 19 Sep 2009 02:20 | 4 | Here is my source : #include <stdio.h> int n,m; long y[60][60]; char in[60][60],x[60][60],sel[3000]; void read_data() { int i,j; FILE *f=stdin; fscanf(f,"%d%d",&m,&n); fscanf(f,"%c",&in[0][0]); for(i=0;i<m;i++) fgets(in[i],100,f); for(i=0;i<m;i++) for(j=0;j<n;j++) fscanf(f,"%ld",&y[i][j]); } void init() { int i; for(i=0;i<=50;i++) sel[i*i]=1; //sel[i]== 1 if i==(X*X) // 0 else } void expand(int a,int b,int nr) { int i,j; for(i=0;i<m;i++) for(j=0;j<n;j++) if(j==b || i==a || sel[((i-a)*(i-a)+(j-b)*(j-b))]) x[i][j]=x[i][j] ^ nr; } void solve() { int i,j; init(); for(i=0;i<m;i++) for(j=0;j<n;j++) if(y[i][j])expand(i,j,y[i][j]%2); } void print() { int i,j; FILE *f=stdout; for(i=0;i<m;i++) { for(j=0;j<n;j++) if(x[i][j]) if(in[i][j]=='B')fprintf(f,"W"); else fprintf(f,"B"); else fprintf(f,"%c",in[i][j]); fprintf(f,"\n"); } } void main() { read_data(); solve(); print(); } Simple (+) Andrey Popyk (popyk@ief.tup.km.ua) 30 Mar 2002 19:59 if in expand (i-a)=50 and (j-b)=50 then (i-a)*(i-a)+(j-b)*(j-b)=5000 Just change sel[3000] // need more! and void init() { int i; for(i=0;i<=50;i++) // not 50!!! need more!!! sel[i*i]=1; //sel[i]== 1 if i==(X*X) // 0 else } | A question about sample test | AlMag | 1125. Hopscotch | 27 Aug 2009 16:08 | 3 | Why the cell [6][4] is 'W' in the output? We changed this cell 138 times. I think it must be 'B' as in input. Can U explain me? Please, Answer me. I know, that I'm wrong, 'cuz there are a lot of ACers. Can U explain me my mistake? Because a[2,1] can step on it Edited by author 27.08.2009 16:14 | Please somebody explain me the solution | Husan | 1125. Hopscotch | 6 Oct 2008 20:04 | 1 | | mistake in problem statement | Alexander Mangilyov (TNU) | 1125. Hopscotch | 17 Jul 2007 16:34 | 2 | There are N rows And M columns. My solution with M rows and N columns has got AC | I have a WA on test 2. | Andrey Vusik | 1125. Hopscotch | 21 Feb 2007 20:53 | 1 | I have a WA on the test 2. Who nows it, please, help me. My program: var i,j,n,m,x:longint; s:array[1..50,1..50]of string[1]; a:array[1..50,1..50]of integer; procedure redata; begin fillchar(a,sizeof(a),0); readln(n,m); for i:=1 to n do begin for j:=1 to m do read(s[i,j]); readln; end; for i:=1 to n do begin for j:=1 to m do begin read(x); if x mod 2=1 then a[i,j]:=1; end; readln; end; end; procedure zamena; var k,x,y:integer; begin for k:=1 to m do if s[i,k]='W' then s[i,k]:='B' else s[i,k]:='W'; for k:=1 to n do if s[k,j]='W' then s[k,j]:='B' else s[k,j]:='W'; if s[i,j]='W' then s[i,j]:='B' else s[i,j]:='W'; for X:=1 to 50 do for Y:=X to 50 do if frac(sqrt((X*X)+(Y*Y)))=0 then begin if (i-x>0)and(j-y>0) then BEGIN if s[i-x,j-y]='W' then s[i-x,j-y]:='B' else s[i-x,j-y]:='W';END; if (i-y>0)and(j-x>0) then BEGIN if s[i-y,j-x]='W' then s[i-y,j-x]:='B' else s[i-y,j-x]:='W';END; if (i-y>0)and(j+x<=N) then BEGIN if s[i-y,j+x]='W' then s[i-y,j+x]:='B' else s[i-y,j+x]:='W';END; if (i+y<=M)and(j-x>0) then BEGIN if s[i+y,j-x]='W' then s[i+y,j-x]:='B' else s[i+y,j-x]:='W';END; if (i-x>0)and(j+y<=N) then BEGIN if s[i-x,j+y]='W' then s[i-x,j+y]:='B' else s[i-x,j+y]:='W';END; if (i+x<M)and(j-y>0) then BEGIN if s[i+x,j-y]='W' then s[i+x,j-y]:='B' else s[i+x,j-y]:='W';END; if (i+x<=M)and(j+y<=N) then BEGIN if s[i+x,j+y]='W' then s[i+x,j+y]:='B' else s[i+x,j+y]:='W';END; if (i+y<=M)and(j+x<=M) then BEGIN if s[i+y,j+x]='W' then s[i+y,j+x]:='B' else s[i+y,j+x]:='W';END; end; end; procedure main; begin for i:=1 to n do for j:=1 to m do if a[i,j]=1 then zamena; end; procedure outdata; begin for i:=1 to n do begin for j:=1 to m do write(s[i,j]); writeln; end; end; begin redata; main; outdata; end. | What mean integer num of meter? | Piratek-(akaDK) | 1125. Hopscotch | 18 Jan 2007 22:53 | 2 | First i Think that it means horisontal and vertical num? but when i have written my program it did not pass that test! What mean integer num of meter? It's just simple problem but what's wrong? type longint = int64; var count,n,m,i,j,ii,jj:system.longint; Colors: array [1..50,1..50] of longint; a : array [1..50,1..50] of longint; sq : array [1..5000] of extended; can : array [1..5000] of boolean; C:char; begin assign(input,'input.txt');reset(input); assign(output,'output.txt');rewrite(output); readln(n,m); for i:= 1 to n do begin for j:= 1 to m do begin read(c); case c of 'B': Colors[i,j] := 0; 'W': Colors[i,j] := 1; end; end; readln; end; for i:= 1 to n do for j:=1 to m do read(a[i,j]); for i:= 1 to 5000 do sq[i] := sqrt(i); for i:= 1 to 5000 do can[i] := sqr(trunc(sq[i])) = i; for i:= 1 to n do begin for j:= 1 to m do begin count := 0; for ii := 1 to n do for jj := 1 to m do begin if (i = ii) or (j = jj) then count := Count + a[ii,jj] else begin if can[(i - ii)*(i - ii) + (j - jj)*(j - jj)] then inc(count,a[ii,jj]); end; end; if count mod 2 = 1 then Colors[i,j] := (Colors[i,j] + 1) mod 2; if Colors[i,j] = 0 then write('B') else write('W'); end; writeln; end; close(input);close(output); end. | 101 kb 0.001 s | Виктор Крупко | 1125. Hopscotch | 20 Jun 2005 01:33 | 1 | | Please, does anyone give me AC program(Pascal). I got WA always. My mail:marina_twins@mail.ru | marina_ufa | 1125. Hopscotch | 4 Jun 2004 12:10 | 1 | | Please, does anyone give me AC program(Pascal). I got WA always. | marina_ufa | 1125. Hopscotch | 2 Jun 2004 12:47 | 3 | Edited by author 03.06.2004 14:57 Edited by author 03.06.2004 14:57 | I got WA!!! Who can help me? | Li Xun | 1125. Hopscotch | 12 May 2004 09:39 | 2 | const maxn=50; type hl=array[1..maxn] of 0..1; var data:array[1..maxn,1..maxn] of longint; f:array[1..maxn,1..maxn] of 0..1; h,l:hl; i,j,k,n,m:longint; color:array[1..maxn,1..maxn] of char; function min(r,t:longint):longint; begin if r<t then min:=r else min:=t end; procedure make(x,y:longint); begin for k:=min((m-i) div x,(n-j) div y) downto 1 do f[i+k*x,j+k*y]:=1-f[i+k*x,j+k*y]; for k:=min((m-i) div x,(j-1) div y) downto 1 do f[i+k*x,j-k*y]:=1-f[i+k*x,j-k*y]; for k:=min((i-1) div x,(j-1) div y) downto 1 do f[i-k*x,j-k*y]:=1-f[i-k*x,j-k*y]; for k:=min((i-1) div x,(n-j) div y) downto 1 do f[i-k*x,j+k*y]:=1-f[i-k*x,j+k*y] end; begin assign(input,'input.in'); reset(input); readln(m,n); for i:=1 to m do begin for j:=1 to n do read(color[i,j]); readln end; for i:=1 to m do for j:=1 to n do read(data[i,j]); close(input); fillchar(h,sizeof(h),0); l:=h; fillchar(f,sizeof(f),0); for i:=1 to m do for j:=1 to n do if odd(data[i,j]) then begin h[i]:=1-h[i]; l[j]:=1-l[j]; make(3,4); make(4,3); make(5,12); make(12,5) end; for i:=1 to m do begin for j:=1 to n do if color[i,j]='W' then if odd(h[i]+l[j]+f[i,j]+data[i,j]) then write('B') else write('W') else if odd(h[i]+l[j]+f[i,j]+data[i,j]) then write('W') else write('B'); writeln end end. very obvious mistake,there are other numbers fit x*x+y*y=z*z for example 7*7+24*24=25*25 8*8+15*15=17*17 const maxn=50; | I got TL WHo can help me?!!! | kkk | 1125. Hopscotch | 26 May 2002 16:02 | 1 | My pro #include<stdio.h> #include<math.h> main() { int m,n,i,j,b[50][50],data,k,p,q,r,h,t[50][50]; char a[50][50],c; scanf("%d%d",&m,&n); c=getchar(); for(i=0;i<50;i++) for(j=0;j<50;j++) t[i][j]=0; for(i=0;i<m;i++) { for(j=0;j<n;j++) { c=getchar(); if(c=='W') a[i][j]=0; else a[i][j]=1; } c=getchar(); } for(i=0;i<m;i++) for(j=0;j<n;j++) { scanf("%d",&data); b[i][j]=data%2; } for(i=0;i<m;i++) for(j=0;j<n;j++) { if(b[i][j]==1) { /* for(k=0;k<m;k++) { if(a[k][j]==1) a[k][j]=0; else a[k][j]=1; } for(k=0;k<n;k++) { if(a[i][k]==1) a[i][k]=0; else a[i][k]=1; } */ /* if(a[i][j]==1) a[i][j]=0; else a[i][j]=1;*/ for(p=0;p<m;p++) for(q=0;q<n;q++) { if(p==i) t[p][q]++; else if(q==j) t[p][q]++; else{ r=(p-i)*(p-i)+(q-j)*(q-j); h=sqrt(r); if(r==h*h) { t[p][q]++; } } } } } for(i=0;i<m;i++) for(j=0;j<n;j++) { t[i][j]=t[i][j]%2; if(t[i][j]==1) { if(a[i][j]==0) a[i][j]=1; else a[i][j]=0; } } for(i=0;i<m-1;i++) { for(j=0;j<n;j++) { if(a[i][j]==0) printf("W"); else printf("B"); } printf("\n"); } for(j=0;j<n;j++) { if(a[i][j]==0) printf("W"); else printf("B"); } } | I got TL | kkk | 1125. Hopscotch | 26 May 2002 16:02 | 1 | |
|
|