10908 - Largest Square

All about problems in Volume 109. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

tan_Yui
Experienced poster
Posts: 155
Joined: Sat Jul 10, 2004 12:41 am

Re: 10908 (WA)

Post by tan_Yui » Fri Sep 23, 2005 5:40 pm

Anonymous wrote:my output is 1 ?
is there any wrong ?
Are you SRX. ?
If so, your code outputs 7, but correct answer is 1.

Thank you.

tan_Yui
Experienced poster
Posts: 155
Joined: Sat Jul 10, 2004 12:41 am

Re: 10908 (WA)

Post by tan_Yui » Fri Sep 23, 2005 6:07 pm

Anonymous wrote:but I excute my code and my output is 1
Oh, really? Your code outputs 7 in my PC.
I try to check my environment....

Thank you.

tan_Yui
Experienced poster
Posts: 155
Joined: Sat Jul 10, 2004 12:41 am

Re: 10908 (WA)

Post by tan_Yui » Fri Sep 23, 2005 7:19 pm

I checked your code again and found the bug.
You have forgotten to initialize a boolean value, so your code outputs wrong answer in my PC.
Change to like following, you will get Accepted.
for ( mymin=ans, check = false ; mymin && !check ; mymin-- ){
Best regards.

Observer
Guru
Posts: 570
Joined: Sat May 10, 2003 4:20 am
Location: Hong Kong

Post by Observer » Mon Sep 26, 2005 5:24 pm

Hi,

Your code gets Compile Error because you cannot use "result" as a variable name in FreePascal. Change that and you'll get Accepted.

Have fun! :wink:

P.S. Why are there so many "Guests" recently? Something wrong with the board??
7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org

FAQ
Learning poster
Posts: 84
Joined: Wed Jan 28, 2004 6:23 pm

Aced

Post by FAQ » Tue Sep 27, 2005 4:30 am

nice, thanks a lot, I got AC :)
yesterday I didn't give my password when posting => "Guest", now I can't edit that post too :-S
So how can I delete the source code now ?

User avatar
CodeMaker
Experienced poster
Posts: 183
Joined: Thu Nov 11, 2004 12:35 pm
Location: AIUB, Bangladesh

Post by CodeMaker » Mon Oct 03, 2005 8:45 pm

one input/output match is no big deal, specially if it is sample I/O. judge data has 1000's of inputs. most of the time sample I/O is not present in judge data. Once my friend got Accepted in a problem in contest which even doesn't match sample I/O :) so, keep making more I/O to test ur code.

here i am giving some I/O for you, test by them.....

input:

Code: Select all

5
7 10 5
abbbabaaaa
abbbaaaaaa
abbbbaaaaa
baabbaaaaa
aaaaaaaaaa
aaccaaaaaa
aaccaaaaaa
1 2
2 4
4 6
6 3
4 7
1 1 1
a
0 0
0 0 0
5 5 3
AAAAA
ABABA
ABABA
ABABA
AAAAA
2 2
0 0
1 1
20 30 5
111111111222222222333333311111
111111111112222233333311111444
111222111111122222222222111133
222222222222222222222222222222
333333312222222221111111111111
333333333332222222222222211111
333333311112222224444411111111
333333333332222244444411111111
333333311112222244444444444444
333333333322222224444444444443
333333333332222244444411111111
333333311112222244444444444444
333333333322222224444444444443
111111111111111111111111111111
111111111111111111111111111122
111111333311111111111111111122
111111333311111333333333333333
111111333311111111111111111111
111111333311111111111111111111
111111333311111111111111111111
1 1
8 3
17 8
7 20
5 13

output:

Code: Select all

7 10 5
3
1
3
1
5
1 1 1
1
0 0 0
5 5 3
1
1
1
20 30 5
3
7
3
3
5
Jalal : AIUB SPARKS

d12ag0n
New poster
Posts: 4
Joined: Mon Jun 06, 2005 1:51 pm
Contact:

Post by d12ag0n » Tue Oct 11, 2005 11:25 am

could anyone give me some critical test cases.
I got WA with my code ...
here is my code ....

Code: Select all

#include <stdio.h>

int n,x,y,q,i,r,c,rad;
char map[105][105];

int main()
{
#ifndef ONLINE_JUDGE
	freopen("10908.in","r",stdin);
	freopen("10908.out","w",stdout);
#endif
	scanf("%d",&n);
	while (n)
	{
		scanf("%d %d %d\n",&y,&x,&q);
		for (i=0;i<y;i++) gets(map[i]);
		printf("%d %d %d\n",y,x,q);
		while (q)
		{
			scanf("%d %d",&r,&c);
			rad=1;
			while (1)
			{
				if (r<rad||r+rad==y||c<rad||c+rad==x) break;
				for (i=0;i<(rad<<1)+1;i++)
					if (map[r-rad][c-rad+i]!=map[r][c] || map[r+rad][c-rad+i]!=map[r][c]) break;
				if (i<(rad<<1)+1) break;
				for (i=0;i<(rad<<1)-1;i++)
					if (map[r-rad+i][c-rad]!=map[r][c] || map[r-rad+i][c+rad]!=map[r][c]) break;
				if (i<(rad<<1)-1) break;
				rad++;
			}
			printf("%d\n",((rad-1)<<1)+1);
			q--;
		}
		n--;
	}
	return 0;
}

d12ag0n
New poster
Posts: 4
Joined: Mon Jun 06, 2005 1:51 pm
Contact:

Post by d12ag0n » Tue Oct 11, 2005 11:35 am

Anonymous wrote:i'm getting WA with my code ...
my code have passed the test case above ...
could anyone help me ???

here is my code

Code: Select all

#include <stdio.h>

int n,x,y,q,i,r,c,rad;
char map[105][105];

int main()
{
#ifndef ONLINE_JUDGE
	freopen("10908.in","r",stdin);
	freopen("10908.out","w",stdout);
#endif
	scanf("%d",&n);
	while (n)
	{
		scanf("%d %d %d\n",&y,&x,&q);
		for (i=0;i<y;i++) gets(map[i]);
		printf("%d %d %d\n",y,x,q);
		while (q)
		{
			scanf("%d %d",&r,&c);
			rad=1;
			while (1)
			{
				if (r<rad||r+rad==y||c<rad||c+rad==x) break;
				for (i=0;i<(rad<<1)+1;i++)
					if (map[r-rad][c-rad+i]!=map[r][c] || map[r+rad][c-rad+i]!=map[r][c]) break;
				if (i<(rad<<1)+1) break;
				for (i=0;i<(rad<<1)-1;i++)
					if (map[r-rad+i][c-rad]!=map[r][c] || map[r-rad+i][c+rad]!=map[r][c]) break;
				if (i<(rad<<1)-1) break;
				rad++;
			}
			printf("%d\n",((rad-1)<<1)+1);
			q--;
		}
		n--;
	}
	return 0;
}
that is my posting ... i forgot to login first ...
could anyone help me with this problem ... ???

tan_Yui
Experienced poster
Posts: 155
Joined: Sat Jul 10, 2004 12:41 am

Post by tan_Yui » Tue Oct 11, 2005 3:02 pm

Hi, d12ag0n.
Try to use this input. :)

Input :
1
15 15 12
bbbbbbbbbbbbbbb
bbbbbbbbbbbbbbb
bbgbgbbbbbbbbbb
bbbgbbbbbbbbbbb
bbgbgbbbbbbbbbb
bbbbbbbbbbbbbbb
bbbbbbxbxbbbbbb
bbbbbbbbbbbbbbb
bbbbbbxbxbbbbbb
bbbbbbbbbbbbbbb
bbbbbbbbbbbbbbb
bbbbbbbbbbbbbbb
bbbbbbbbbbbbbbb
bbbbbbbbbbbbbbb
bbbbbbbbbbbbbbb
6 7
8 7
7 6
7 7
7 8
6 6
3 3
9 5
1 1
3 3
10 11
4 10
Output should be :
15 15 12
1
1
1
1
1
1
1
1
1
1
5
3
Best regards.

d12ag0n
New poster
Posts: 4
Joined: Mon Jun 06, 2005 1:51 pm
Contact:

Post by d12ag0n » Wed Oct 12, 2005 5:56 am

thank you tan_Yui.
I have found my stupid mistake.
I got AC ... :D :D :D :lol: :lol: :lol:

sumankar
A great helper
Posts: 286
Joined: Tue Mar 25, 2003 8:36 am
Location: calcutta
Contact:

Post by sumankar » Mon Feb 06, 2006 11:38 am

I checked all available threads for this one. My code seems to give correct output for all of them.
Can I get some more test cases?

I would like to know as well if the input is well formed i.e. can there be spaces in between a particular row description?

Regards,
Suman.

mamun
A great helper
Posts: 286
Joined: Mon Oct 03, 2005 1:54 pm
Location: Bangladesh
Contact:

Post by mamun » Mon Feb 06, 2006 2:50 pm

sumankar wrote:can there be spaces in between a particular row description?
Nope.

Input

Code: Select all

1
7 7 8
aaaaaaa
aabbbaa
abbbbba
abbbbba
abbbbba
aabbbaa
aaaaaaa
3 3
2 3
4 2
5 2
0 0
6 6
4 4
5 5
Output

Code: Select all

7 7 8
3
3
1
1
1
1
1
1

sumankar
A great helper
Posts: 286
Joined: Tue Mar 25, 2003 8:36 am
Location: calcutta
Contact:

Post by sumankar » Tue Feb 07, 2006 6:41 am

Thanks mamun for your test case. But still getting correct answers at home, and a WA at uva!

Emilio
Experienced poster
Posts: 163
Joined: Sun Oct 17, 2004 8:31 pm
Location: Murcia, Spain

Post by Emilio » Tue Feb 07, 2006 9:40 am

Maybe this test cases can be interesting:

Code: Select all

2
7 10 4
abbbaaaaaa
a bbaaaa a
abbbaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaccaaaaaa
aaccaaaaaa
1 2
2 4
4 6
5 2
1 1 1
a
7 8

sumankar
A great helper
Posts: 286
Joined: Tue Mar 25, 2003 8:36 am
Location: calcutta
Contact:

Post by sumankar » Tue Feb 07, 2006 10:48 am

Code: Select all

7 10 4
1
1
5
1
1 1 1
0

Post Reply

Return to “Volume 109 (10900-10999)”