232 - Crossword Answers

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

Moderator: Board moderators

Post Reply
deddy one
Experienced poster
Posts: 120
Joined: Tue Nov 12, 2002 7:36 pm

232 - Crossword Answers

Post by deddy one » Wed Apr 16, 2003 4:34 am

I get WA for this one, here's my code
hopefully someone will tell me what's wrong

[c]

cut , got AC now

[/c]

ayaw
New poster
Posts: 18
Joined: Fri May 23, 2003 3:52 pm
Contact:

Post by ayaw » Mon May 26, 2003 9:31 am

i also got WA...
what u do to get AC deddy??
help me please i've stucked for this one
peace...

deddy one
Experienced poster
Posts: 120
Joined: Tue Nov 12, 2002 7:36 pm

Post by deddy one » Mon May 26, 2003 2:14 pm

I only increase the array size with no further change in my code
and it get Accepted. :D

I think something funny like this could
happen, like when they say you that
the max row and col is 10 , but actually
you need to initialize more than that. :-?

In this case, just declare abundant array size
like

char words[10] == > into char words[10000]
or
char map [10][10] == > into char map [200][200]




something like this ussually lead to Runtime Error
but sometimes it lead to Wrong Answer.
try to sacrifice memory and if you still got
WA , maybe you made little mistake
in the algorithm, like when numbering the map.

hope that helps. :wink:

ayaw
New poster
Posts: 18
Joined: Fri May 23, 2003 3:52 pm
Contact:

Post by ayaw » Mon May 26, 2003 2:46 pm

i've increase the array, but still get WA
here is my code :

Code: Select all

#include <stdio.h>

char buffer[100][110];
char number[100][110];

void accross(int h, int w) {
	int i,j,flag;
	printf("Across\n");
	for(i=0;i<h;i++)
		for(j=0;j<w;j++) {
			if(number[i][j]!='0') {
				flag=0;
				if(j==0) flag=1;
				else if(buffer[i][j-1]=='*') flag=1;
				if(flag) {
					printf("%3d.",number[i][j]-'0');
					for(flag=j;buffer[i][flag]!='*'&&flag<w;flag++) putchar(buffer[i][flag]);
					printf("\n");
				}
			}
		}
}

void down(int h, int w) {
	int i,j,flag;
	printf("Down\n");
	for(i=0;i<h;i++)
		for(j=0;j<w;j++) {
			if(number[i][j]!='0') {
				flag=0;
				if(i==0) flag=1;
				else if(buffer[i-1][j]=='*') flag=1;
				if(flag) {
					printf("%3d.",number[i][j]-'0');
					for(flag=i;buffer[flag][j]!='*'&&flag<h;flag++) putchar(buffer[flag][j]);
					printf("\n");
				}
			}
		}
}

answer(int i,int j) {
	if(buffer[i][j]=='*') return 0;
	if(i==0||j==0||buffer[i][j-1]=='*'||buffer[i-1][j]=='*') return 1;
	return 0;
}

void build(int h, int w) {
	int i,j,count=1;
	for(i=0;i<h;i++)
		for(j=0;j<w;j++) number[i][j]='0';
	for(i=0;i<h;i++)
		for(j=0;j<w;j++) if(answer(i,j)) number[i][j]='0'+count++;
}

main () {
	int i,j,h,w,count=1;
	while(1) {
		scanf("%d %d\n",&h,&w);
		if(h==0||w==0) return 0;
		for(i=0;i<h;i++) {
			for(j=0;j<w;j++) buffer[i][j]=getchar();
			scanf("\n");
		}
		if(count!=1) printf("\n");
		printf("puzzle #%d\n",count++);
		build(h,w);
		accross(h,w);
		down(h,w);
	}
}
peace...

deddy one
Experienced poster
Posts: 120
Joined: Tue Nov 12, 2002 7:36 pm

Post by deddy one » Mon May 26, 2003 4:15 pm

maybe the problem is scanning the input
in your solution

Code: Select all

 while(1) { 
      scanf("%d %d\n",&h,&w); 
      if(h==0||w==0) return 0; 
      for(i=0;i<h;i++) { 
         for(j=0;j<w;j++) buffer[i][j]=getchar(); 
         scanf("\n"); 
      } 
.......
      
while in my solution

Code: Select all

 while (scanf ("%d",&r) == 1) {
   if (r==0) break;
scanf ("%d",&c);
   for (i=0;i<r;i++)
   scanf ("%s",map[i]);
........
I haven't compiled your solution though.

aakash_mandhar
New poster
Posts: 38
Joined: Thu Dec 11, 2003 3:40 pm
Location: Bangalore

Increase the array size.....

Post by aakash_mandhar » Thu Dec 11, 2003 3:46 pm

Even though the problem states r<=10 c<=10 Take a large array size i took 100x100
It really frustrated me.................. :evil: but i eventually solved it.. :D
Sorry that the code is not commented but is self explanatory.....
Here is my code...
[cpp]
CUT
[/cpp]
...I was born to code...

User avatar
A1
Experienced poster
Posts: 173
Joined: Wed Jan 28, 2004 3:34 pm
Location: Bangladesh

Post by A1 » Sun Dec 19, 2004 4:05 pm

I hate this kind of Disgusting problem description.
look at this page:
http://acm.uva.es/p/v2/232.fix.html
it say that problem (output) description has been fixed, my question is where?? :evil:
in problem it is still r<=10 and c<= 10 and in input file it is still more then 100X100 inputs!!

User avatar
ibrahim
Experienced poster
Posts: 149
Joined: Mon Feb 07, 2005 10:28 pm
Location: Northern University, Bangladesh
Contact:

Post by ibrahim » Tue Aug 23, 2005 4:43 am

Words in each list must be output one-per-line in increasing order of the number of their corresponding definitions.
What it means and what is the numbering process.

paradise_737
New poster
Posts: 5
Joined: Sun Aug 23, 2009 7:26 am

232 CROSSWORDS ANSWERS

Post by paradise_737 » Mon Sep 07, 2009 6:48 pm

HI GUYS AM STUCK IN THIS PROBLEM FOR 3 HOURS BUT I'M NOT GETTING TO THE RIGHT OUTPUT IMPLEMENTATION

ANY BODY CAN HELP PLEASE :cry: :cry: :cry:

lighted
Guru
Posts: 585
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: 232 WA -- crosswords answer

Post by lighted » Mon Jun 16, 2014 12:28 pm

This is very easy problem. But i can't get acc. Why wa???

Code: Select all

removed, after acc..
I am really full. I was trying to read and write from file.

// #ifndef ONLINE_JUDGE
freopen("input.txt", "rt", stdin);
freopen("output.txt", "wt", stdout);
// #endif
Last edited by lighted on Tue Jun 17, 2014 4:13 pm, edited 1 time in total.
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 232 WA -- crosswords answer

Post by brianfry713 » Mon Jun 16, 2014 8:15 pm

Don't read and write to files.
Check input and AC output for thousands of problems on uDebug!

User avatar
uDebug
A great helper
Posts: 475
Joined: Tue Jul 24, 2012 4:23 pm

Re: 232 - Crossword Answers

Post by uDebug » Sat Sep 20, 2014 8:57 am

I've posted critical input for this problem on uDebug.
Check input and AC output for over 7,500 problems on uDebug!

Find us on Facebook. Follow us on Twitter.

metaphysis
Experienced poster
Posts: 139
Joined: Wed May 18, 2011 3:04 pm

Re: 232 - Crossword Answers

Post by metaphysis » Wed May 11, 2016 2:09 am

The white squares of first row or column are "eligible". Problem statement is not so clear.

Post Reply

Return to “Volume 2 (200-299)”