Page 1 of 1

232 - Crossword Answers

Posted: Wed Apr 16, 2003 4:34 am
by deddy one
I get WA for this one, here's my code
hopefully someone will tell me what's wrong

[c]

cut , got AC now

[/c]

Posted: Mon May 26, 2003 9:31 am
by ayaw
i also got WA...
what u do to get AC deddy??
help me please i've stucked for this one

Posted: Mon May 26, 2003 2:14 pm
by deddy one
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:

Posted: Mon May 26, 2003 2:46 pm
by ayaw
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);
	}
}

Posted: Mon May 26, 2003 4:15 pm
by deddy one
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.

Increase the array size.....

Posted: Thu Dec 11, 2003 3:46 pm
by aakash_mandhar
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]

Posted: Sun Dec 19, 2004 4:05 pm
by A1
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!!

Posted: Tue Aug 23, 2005 4:43 am
by ibrahim
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.

232 CROSSWORDS ANSWERS

Posted: Mon Sep 07, 2009 6:48 pm
by paradise_737
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:

Re: 232 WA -- crosswords answer

Posted: Mon Jun 16, 2014 12:28 pm
by lighted
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

Re: 232 WA -- crosswords answer

Posted: Mon Jun 16, 2014 8:15 pm
by brianfry713
Don't read and write to files.

Re: 232 - Crossword Answers

Posted: Sat Sep 20, 2014 8:57 am
by uDebug
I've posted critical input for this problem on uDebug.

Re: 232 - Crossword Answers

Posted: Wed May 11, 2016 2:09 am
by metaphysis
The white squares of first row or column are "eligible". Problem statement is not so clear.