10230 - Savage Garden
Moderator: Board moderators
10230 - Savage Garden
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 ^^
Or is there any strange input ?
I can run my sample input correctly up to
2^10 dimension.
Thank you ^^
-
- A great helper
- Posts: 284
- Joined: Thu Feb 28, 2002 2:00 am
- Location: Germany
- Contact:
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).
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).
-
- A great helper
- Posts: 284
- Joined: Thu Feb 28, 2002 2:00 am
- Location: Germany
- Contact:
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)
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>
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
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>
-
- A great helper
- Posts: 284
- Joined: Thu Feb 28, 2002 2:00 am
- Location: Germany
- Contact:
Am I misinterpreting the question?
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
(I have empty lines after each test case).
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
-
- New poster
- Posts: 30
- Joined: Wed Oct 23, 2002 6:53 am
what can i do to avoid TL?
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
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
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;
}
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 10230 - Savage Garden
Try this input on your code: 10 923 871
At the end a number of lines including #233 you're printing an illegal character.
At the end a number of lines including #233 you're printing an illegal character.
Check input and AC output for thousands of problems on uDebug!