Moderator: Board moderators

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

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:
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
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
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.
ayaw
New poster
Posts: 18
Joined: Fri May 23, 2003 3:52 pm
Contact:
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");
}
}
}
}

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++)
}

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
maybe the problem is scanning the input

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.....

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]
...I was born to code...
A1
Experienced poster
Posts: 173
Joined: Wed Jan 28, 2004 3:34 pm
I hate this kind of Disgusting problem description.
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!!
ibrahim
Experienced poster
Posts: 149
Joined: Mon Feb 07, 2005 10:28 pm
Contact:
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.
New poster
Posts: 5
Joined: Sun Aug 23, 2009 7:26 am

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

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

### Re: 232 WA -- crosswords answer

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

Don't read and write to files.
Check input and AC output for thousands of problems on uDebug!
uDebug
A great helper
Posts: 475
Joined: Tue Jul 24, 2012 4:23 pm

### Re: 232 - Crossword Answers

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