Page 1 of 1
10230 - Savage Garden
Posted: Sun Mar 03, 2002 3:58 pm
by DemonCris
Is there any trap in this problem ?
Or is there any strange input ?
I can run my sample input correctly up to
2^10 dimension.
Thank you ^^
Posted: Mon Mar 04, 2002 8:22 am
by Stefan Pochmann
I don't think there's a trap. And the input is as easy as it can get. Are you sure your program is correct? Can we see your output for, lets say, "5 20 14"?
Or maybe you should check decreasing sizes in the input. This is always a good technique: reverse the order of the test cases (of course here we only have one, so one has to invent some first).
Posted: Mon Mar 04, 2002 11:36 am
by DemonCris
As you say "Or maybe you should check decreasing sizes in the input. This is always a good technique: reverse the order of the test cases (of course here we only have one, so one has to invent some first)."
I can't figure out it ...
It sounds like a good method to test your program, doesn't it?
Posted: Tue Mar 05, 2002 3:14 am
by Stefan Pochmann
I'm not sure I understand what you mean with your last posting. Do you mean you tried it and your program still worked fine?
Please post the requested example output, maybe that will tell us more...
Posted: Sat Mar 23, 2002 6:26 pm
by bolster
I'm getting WA for it too... it might be because of the way I do the output...
they say you can use a-z, but I only actually use a-f (cause you don't really need the others... the neighbours are still ok)
Code: Select all
bbccddbbddbbddbbddbbddbbddbbddbb
baacdaabdaabdaabdaabdaabdaabdaab
cabbeeaceacceeaceacceeaceacceeac
ccbaaecceecaaecceecaaecceecaaecc
ddeabbddffbbafbbffbaffbbffbbafbb
daeebaadfaabffabfabbfaabfaabffab
baacdabbccadcaadcaadcaddccadcaad
bbccddbaacddccddccddccdaacddccdd
ddeeffcabbeeffbbeebbeebbaebbeebb
daaefaccbaaefaabeaabeaabeeabeaab
baccbaadeabbccadcaddccadcaadccad
bbcabbddeebaacddccdaacddccddacdd
ddeaafccffcabbeeffbbaebbeebaaebb
daeeffacfaccbaaefab*eeabeabbeeab
baacbaadbaadeabbcaadbaacdaacdaac
bbccbbddbbddeebaccddbbccddccddcc
ddeeffcceeccffcaabeeffeeffbbeebb
daaefaaceaacfaccbbaefaaefaabeaab
baccbbadbaddbaadeaabccabcaddccad
bbcaabddbbdabbddeebbacbbccdaacdd
ddeaffcceecaaeccffcaaeddeebbaebb
daeefaaceacceeacfacceeadeaabeeab
baacbaddbaadbaadbaadbaacbbacdaac
bbccbbdabbddbbddbbddbbccabccddcc
ddeeffcaaecceecceecceedaaeffbbee
daaefacceeaceaaceaaceaddeeafbaae
baccbaadbaadbbadbaddbaacbaacddab
bbcabbddbbddabddbbdabbccbbccadbb
ddeaafcceecaaecceecaaeddeedaaecc
daeeffaceacceeaceacceeadeaddeeac
baacbaadbaadbaadbaadbaacbaacbaad
bbccbbddbbddbbddbbddbbccbbccbbdd
Am I misinterpreting it? And do they want an extra blank line between test cases? thanks...
bolster
<font size=-1>[ This Message was edited by: bolster on 2002-03-23 17:26 ]</font>
<font size=-1>[ This Message was edited by: bolster on 2002-03-23 17:27 ]</font>
Posted: Sun Mar 24, 2002 5:27 am
by Stefan Pochmann
Looks good. Only L's, didn't see any adjacent L's of same color, '*' is at the right spot.
Yes, the problem states that there has to be a blank line after each testcase.
My accepted program has the blank lines and doesn't get higher than 'i'.
Posted: Mon Mar 25, 2002 3:00 am
by bolster
Woohoo I got AC! =)
it really WAS the new line thing... missed it i guess... i'm surprised it didn't give me format error though. thanks
Am I misinterpreting the question?
Posted: Tue Jun 25, 2002 6:35 pm
by xenon
I read the problem description ten times, but I think the following solution to the input "5 20 14" is in accordance with it. Getting WA's make me feel there should only be tiny Ls. Am I right? Or is my code wrong
Code: Select all
aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbb
aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbb
aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbb
aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbb
aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbb
aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbb
aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbb
aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbb
aaaaaaaaaaaaaaaaccccccccbbbbbbbb
aaaaaaaaaaaaaaaaccccccccbbbbbbbb
aaaaaaaaaaaaaaaaccccccccbbbbbbbb
aaaaaaaaaaaaaaaaccccccccbbbbbbbb
aaaaaaaaaaaaaaaaddeeccccbbbbbbbb
aaaaaaaaaaaaaaaadde*ccccbbbbbbbb
aaaaaaaaaaaaaaaaddddccccbbbbbbbb
aaaaaaaaaaaaaaaaddddccccbbbbbbbb
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
(I have empty lines after each test case).
Posted: Tue Jun 25, 2002 7:00 pm
by 10153EN
Yes, there should be only *tiny L-shapes* as you said.
There's sth you have misunderstood with the problem

what can i do to avoid TL?
Posted: Tue Sep 23, 2003 1:55 pm
by Amir Aavani
i try to solve it, i use a recursive approach,
Solve (Top, Left, Height, Width: Integer; Pt: TPoint; CharName: char)
where Pt is the place of the space.
is there any special point?
please help

10230 - Savage Garden
Posted: Thu Oct 04, 2012 9:34 am
by bunnyxl
Hi, I am trying to solve the problem 10230 but always got WA. I've tried a lot of test cases, but still can't figure out what's wrong. Can anyone help me with that? Is there some special cases ? Thank you
Code: Select all
#include<iostream>
#include<stdlib.h>
using namespace std;
int a,b,n,s;
char map[1024][1024];
int al[26];
void mark(int x, int y){
al[map[x-1][y-1]-'a']=1;
al[map[x-1][y]-'a']=1;
al[map[x-1][y+1]-'a']=1;
al[map[x][y-1]-'a']=1;
al[map[x][y+1]-'a']=1;
al[map[x+1][y-1]-'a']=1;
al[map[x+1][y]-'a']=1;
al[map[x+1][y+1]-'a']=1;
}
char getal(int x1,int y1, int x2, int y2, int x3, int y3){
int i,j;
for(i=0; i<26; i++)
al[i]=0;
mark(x1,y1);
mark(x2,y2);
mark(x3,y3);
for(i=0; i<26; i++)
if(!al[i])
return i+'a';
}
void div(int x0, int y0,int s, int a, int b){
char c;
int k;
int halfx = s/2+x0;
int halfy = s/2+y0;
int x1,x2,x3,x4;
int y1,y2,y3,y4;
x1 =x3= halfx-1;
x2 =x4= halfx;
y1 =y2= halfy-1;
y3 =y4= halfy;
int x01,x02,x03,x04;
int y01,y02,y03,y04;
x01 = x03=x0;
x02 = x04=halfx;
y01 = y02=y0;
y03 = y04=halfy;
int a1,a2,a3,a4;
int b1,b2,b3,b4;
a1=a3=x1;
a2=a4=x2;
b1=b2=y1;
b3=b4=y3;
if(a <halfx){
k = 3;
if(b<halfy)
k = 1;
}
if(a >=halfx){
k= 4;
if(b < halfy)
k = 2;
}
switch(k){
case 1:c=getal(x2,y2,x3,y3,x4,y4);map[x2][y2]=map[x3][y3]=map[x4][y4]=c;a1=a, b1=b;break;
case 2:c=getal(x1,y1,x3,y3,x4,y4);map[x1][y1]=map[x3][y3]=map[x4][y4]=c;a2=a, b2=b;break;
case 3:c=getal(x1,y1,x2,y2,x4,y4);map[x1][y1]=map[x4][y4]=map[x2][y2]=c;a3=a, b3=b;break;
case 4:c=getal(x1,y1,x3,y3,x2,y2);map[x1][y1]=map[x2][y2]=map[x3][y3]=c;a4=a, b4=b;break;
}
if(s==2)
return;
div(x01,y01,s/2,a1,b1);
div(x02,y02,s/2,a2,b2);
div(x03,y03,s/2,a3,b3);
div(x04,y04,s/2,a4,b4);
}
int main(){
int i,j,k;
int wc=0;
while(cin >> n >> a >> b){
s=1;
while(n--)
s*=2;
for(i=0;i<s;i++)
for(j=0;j<s;j++)
map[i][j]=0;
div(0,0,s, a-1, b-1);
map[a-1][b-1]='*';
for(i=0; i<s; i++){
for(j=0; j<s; j++)
cout << map[j][i];
cout << endl;
}
cout << endl;
}
return 0;
}
Re: 10230 - Savage Garden
Posted: Fri Oct 05, 2012 12:07 am
by brianfry713
Try this input on your code: 10 923 871
At the end a number of lines including #233 you're printing an illegal character.