102 - Ecological Bin Packing

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

Moderator: Board moderators

minskcity
Experienced poster
Posts: 199
Joined: Tue May 14, 2002 10:23 am
Location: Vancouver

NO BUG????

Post by minskcity »

I guess you did not try "1000000000 1000000000 1 1 1 1 1 1 1".......

minskcity
Experienced poster
Posts: 199
Joined: Tue May 14, 2002 10:23 am
Location: Vancouver

report

Post by minskcity »

At the moment I use fread/printf; my time is 0.050s with 0.010 - input, 0.030 - parsing, 0.010 - output. I'm going to try read/write now...

Is handle 0 - reading, 1 - writing?

Ivan Golubev
Experienced poster
Posts: 167
Joined: Fri Oct 19, 2001 2:00 am
Location: Saint Petersburg, Russia

Re: report

Post by Ivan Golubev »

minskcity wrote:Is handle 0 - reading, 1 - writing?
Yeah.

However I think that fread() & read works very similar. So pay attention to your printf() and parsing (well, computing also ;-) ).

minskcity
Experienced poster
Posts: 199
Joined: Tue May 14, 2002 10:23 am
Location: Vancouver

compiler error

Post by minskcity »

According to Valladolid Online Judge there are no file "io.h". What did you include to use read() ?

Here are the compiler error messages:

00862896_24.c:5: io.h: No existe el fichero o el directorio

Ivan Golubev
Experienced poster
Posts: 167
Joined: Fri Oct 19, 2001 2:00 am
Location: Saint Petersburg, Russia

Re: compiler error

Post by Ivan Golubev »

minskcity wrote:According to Valladolid Online Judge there are no file "io.h". What did you include to use read() ?
Nothing. If you're using C it's not necessary to use #include. If you're using C++ define read by your own like:

int read(int, void *, unsigned int);
(or extern int read(int, void *, unsigned int); I'm never submitted solutions in C++.)

The function's code will be successfully linked to your program.

Ivor
Experienced poster
Posts: 150
Joined: Wed Dec 26, 2001 2:00 am
Location: Tallinn, Estonia

Post by Ivor »

Blast it Ivan, I see you managed to regain your throne on 495. Superb... it only seems that some are trying to do it when I have no time. :P

btw, you seem have used asm, what was your best pure C time? Just out of curiosity. Mine's the one you had to beat.

to other people: actually it takes much more than simple IO. You must have a very good handle on many different aspects of optimization. But that's a trade secret :P If you're really interested and have a good imagination you'll soon find out. All you have to do is learn it yourself. It took me more than half a year to get the current time on 102. :)

Ivor
P.S I'll get back to you as soon as my tests are over. :)

Ivan Golubev
Experienced poster
Posts: 167
Joined: Fri Oct 19, 2001 2:00 am
Location: Saint Petersburg, Russia

Post by Ivan Golubev »

btw, you seem have used asm, what was your best pure C time? Just out of curiosity. Mine's the one you had to beat.
My best time with pure C was 0.150. And then I've switched into asm because GCC isn't my favorite compiler. It really limiting when trying to optimise something, I'm preferring to write code by my own than fighting with (dumb!) compiler ;-)

Ivor
Experienced poster
Posts: 150
Joined: Wed Dec 26, 2001 2:00 am
Location: Tallinn, Estonia

Post by Ivor »

Youre wrong :) C compiler is a very powerful thing. If you know how to use it, you can get the same results as with asm.
btw. I just equaled you on 495. I'll see if I can beat you. :P

Ivor
P.S Do you have any other ways of communicating than this board?

Caesum
Experienced poster
Posts: 225
Joined: Fri May 03, 2002 12:14 am
Location: UK
Contact:

Post by Caesum »

is inline asm in gas format for their compiler or intel ?

ie:
is it
mov eax,ebx
or
mov %ebx,%eax
??

presumably its gas since some people have mentioned gcc :(

Ivan Golubev
Experienced poster
Posts: 167
Joined: Fri Oct 19, 2001 2:00 am
Location: Saint Petersburg, Russia

Post by Ivan Golubev »

Caesum wrote:is inline asm in gas format for their compiler or intel ?
Yes, it's in gas format (and I don't like it much).

zerocool
New poster
Posts: 7
Joined: Wed May 15, 2002 10:30 am
Location: Kaohsiung,Taiwan
Contact:

Re: NO BUG????

Post by zerocool »

minskcity wrote:I guess you did not try "1000000000 1000000000 1 1 1 1 1 1 1".......
The answer of my program is

BCG 1000000005

Is any bug in it ?
A mediocrityboy

minskcity
Experienced poster
Posts: 199
Joined: Tue May 14, 2002 10:23 am
Location: Vancouver

that's strange

Post by minskcity »

It printed

"BCG 1e+09"

in Borland C++ 5.02

Fresh
New poster
Posts: 46
Joined: Mon Apr 15, 2002 10:42 am
Contact:

printf

Post by Fresh »

Try this, it may help:

[cpp]
#include <stdio.h>
....
....
printf("%s%1.0f\n",c,min);
[/cpp]

-novice :wink:

Fresh
New poster
Posts: 46
Joined: Mon Apr 15, 2002 10:42 am
Contact:

ASM

Post by Fresh »

Ivor wrote:you seem have used asm
Is this mean that the Online Judge support ASM beside C/C++, Jave and Pascal? If yes, how to submit the solution or any trick to do this?
Ivor wrote:But that's a trade secret If you're really interested and have a good imagination you'll soon find out. All you have to do is learn it yourself.
Learning always need teachers but what will be happen if all teachers take their knowledge as 'trade secret'?

-novice :-?

Stefan Pochmann
A great helper
Posts: 284
Joined: Thu Feb 28, 2002 2:00 am
Location: Germany
Contact:

Re: ASM

Post by Stefan Pochmann »

You can include assembler code inside programs in other languages. I've never done it, but it probably looks sth like this:

int c_function ( int n ) {
begin asm;
assembler code here
end asm;
}

The syntax is probably completely wrong, but I guess the idea is clear.

About that secrets/teachers thing: I agree, sharing knowledge and helping others is a good thing. I don't think asked for help in even a quarter of my posts. And after all, I guess not many of us are a new Ramanujan (you know, that math genius who basically invented all for himself and invented amazing new stuff): http://www-groups.dcs.st-and.ac.uk/~his ... nujan.html

Post Reply

Return to “Volume 1 (100-199)”