232 - Crossword Answers
Moderator: Board moderators
232 - Crossword Answers
I get WA for this one, here's my code
hopefully someone will tell me what's wrong
[c]
cut , got AC now
[/c]
hopefully someone will tell me what's wrong
[c]
cut , got AC now
[/c]
I only increase the array size with no further change in my code
and it get Accepted.
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.
and it get Accepted.

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.

i've increase the array, but still get WA
here is my code :
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...
maybe the problem is scanning the input
in your solution
while in my solution
I haven't compiled your solution though.
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");
}
.......
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]);
........
-
- New poster
- Posts: 38
- Joined: Thu Dec 11, 2003 3:40 pm
- Location: Bangalore
Increase the array size.....
Even though the problem states r<=10 c<=10 Take a large array size i took 100x100
It really frustrated me..................
but i eventually solved it..
Sorry that the code is not commented but is self explanatory.....
Here is my code...
[cpp]
CUT
[/cpp]
It really frustrated me..................


Sorry that the code is not commented but is self explanatory.....
Here is my code...
[cpp]
CUT
[/cpp]
...I was born to code...
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??
in problem it is still r<=10 and c<= 10 and in input file it is still more then 100X100 inputs!!
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??

in problem it is still r<=10 and c<= 10 and in input file it is still more then 100X100 inputs!!
-
- New poster
- Posts: 5
- Joined: Sun Aug 23, 2009 7:26 am
232 CROSSWORDS ANSWERS
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

ANY BODY CAN HELP PLEASE



Re: 232 WA -- crosswords answer
This is very easy problem. But i can't get acc. Why wa???
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
Code: Select all
removed, after acc..
// #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
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 232 WA -- crosswords answer
Don't read and write to files.
Check input and AC output for thousands of problems on uDebug!
-
- Experienced poster
- Posts: 139
- Joined: Wed May 18, 2011 3:04 pm
Re: 232 - Crossword Answers
The white squares of first row or column are "eligible". Problem statement is not so clear.
metaphysis: http://uhunt.onlinejudge.org/id/95895
My solutions for UVa problems: https://github.com/metaphysis/Code.
My solutions for UVa problems: https://github.com/metaphysis/Code.