10941 - Words adjustment
Moderator: Board moderators
-
- New poster
- Posts: 21
- Joined: Sun Oct 05, 2003 11:19 am
- Location: Bulgaria, Shoumen
- Contact:
10941 - Words adjustment
In the input there is some word that's length is more than 1000 (even 1500)!
And I have a question, when I submit a code in C the reply is COMPILE ERROR, but in C++ MEMORY LIMIT or ACCEPTED(WA)
I mean than in C++ the source is being executed while in C it is not, because of memory shortage, why does this happens?
Rostislav
And I have a question, when I submit a code in C the reply is COMPILE ERROR, but in C++ MEMORY LIMIT or ACCEPTED(WA)
I mean than in C++ the source is being executed while in C it is not, because of memory shortage, why does this happens?
Rostislav
There are several functions that work in c++ compiler but not in c. I think you are using those types of function.
And there are some library files you cannot include in c. Like vector.h.
And there are some library files you cannot include in c. Like vector.h.
Ami ekhono shopno dekhi...
HomePage
HomePage
-
- New poster
- Posts: 21
- Joined: Sun Oct 05, 2003 11:19 am
- Location: Bulgaria, Shoumen
- Contact:
I apologize, my mistake!
I had used inline function and my compilator doesn't give any error about that when compiling like a C source. (ussualy i know than it gives COMPILE ERROR when using inline functions but I thought it was something different because at the contest i submited a lot of things and probably I misunderstood some of the replies).
Thank you for your replies.
Rostislav
I had used inline function and my compilator doesn't give any error about that when compiling like a C source. (ussualy i know than it gives COMPILE ERROR when using inline functions but I thought it was something different because at the contest i submited a lot of things and probably I misunderstood some of the replies).
Thank you for your replies.
Rostislav
10941 - Words adjustment
How to determine the adjustment is possible or not?
I have no idea...

I have no idea...


-
- A great helper
- Posts: 281
- Joined: Tue Sep 10, 2002 5:14 am
- Location: Mountain View, CA, USA
- Contact:
Nice example. I think is slightly wrong though. Here is code that generates a very similar example.
On this input, my accepted solution runs in 9.9 seconds on a 2.4GHz CPU and gives the answer
Code: Select all
#include <stdio.h>
char buf[4] = "aaa";
int main()
{
printf( "1\ntestaaa\ntest\n1000\nx\n" );
for( int i = 0; i < 999; i++ )
{
printf( "%s", buf );
for( int j = 0; j < 1000 - 6; j++ ) putchar( 'x' );
int carry = 1;
for( int j = 2; j >= 0; j-- )
{
buf[j] += carry;
if( buf[j] > 'z' ) { buf[j] = 'a'; carry = 1; }
else carry = 0;
}
if( i < 998 ) printf( "%s\n", buf );
else printf( "xxx\n" );
}
}
Code: Select all
994008
If only I had as much free time as I did in college...
-
- Guru
- Posts: 724
- Joined: Wed Dec 19, 2001 2:00 am
- Location: Germany
My solution runs only 0.8 seconds on this test case, but I had to increase the number of nodes I allow in my prefix tree (which would give memory limit exceeded at the online judge).Abednego wrote: On this input, my accepted solution runs in 9.9 seconds on a 2.4GHz CPU and gives the answerCode: Select all
994008
I think that the judge test cases are very poor, and I fear that worst cases exist for every program, such that it will not terminate within 10 seconds.
Hi! Could someone post tricky test cases for this problem?
My program passes the test case mentioned above and also test cases from the original polish olympiad,
but it is getting WA here, and I really don't know why
And I'd like to ask, are there empty lines in the input? I use scanf(" %s",...) to read words, could this be a problem?
My program passes the test case mentioned above and also test cases from the original polish olympiad,
but it is getting WA here, and I really don't know why

And I'd like to ask, are there empty lines in the input? I use scanf(" %s",...) to read words, could this be a problem?