Icpc-practice Archive

List Statistics

  • Total Threads: 128
  • Total Posts: 38

Phrases Used to Find This Thread

  #1  
01-08-2012 10:58 PM
Icpc-practice member admin is online now
User
 

Okay -- I got a challenge for y'all:

I have solved the problem 10823: Of Circles and Squares


http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764

In fact, if you look at the statistics list I am the 5th fastest.

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=

So -- who can beat me?

--
Isaac Traxler -- personal e-mail
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)

  #2  
02-08-2012 12:21 AM
Icpc-practice member admin is online now
User
 

Okay -- I got a challenge for y'all:

I have solved the problem 10823: Of Circles and Squares


http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764

In fact, if you look at the statistics list I am the 5th fastest.

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=

So -- who can beat me?

--
Isaac Traxler -- personal e-mail
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
Starts learning assembly...

Haha I'll look at the problem

Chris McKnight
Sent from my iPhone

On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:

> Okay -- I got a challenge for y'all:
>
> I have solved the problem 10823: Of Circles and Squares
>
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>
> In fact, if you look at the statistics list I am the 5th fastest.
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
> So -- who can beat me?
>
> --
> Isaac Traxler -- personal e-mail
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)

  #3  
03-08-2012 08:59 PM
Icpc-practice member admin is online now
User
 

Okay -- I got a challenge for y'all:

I have solved the problem 10823: Of Circles and Squares


http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764

In fact, if you look at the statistics list I am the 5th fastest.

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=

So -- who can beat me?

--
Isaac Traxler -- personal e-mail
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
Starts learning assembly...

Haha I'll look at the problem

Chris McKnight
Sent from my iPhone

On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:

> Okay -- I got a challenge for y'all:
>
> I have solved the problem 10823: Of Circles and Squares
>
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>
> In fact, if you look at the statistics list I am the 5th fastest.
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
> So -- who can beat me?
>
> --
> Isaac Traxler -- personal e-mail
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
rank 6th code =>
https://github.com/mgavin/acm-code/blob/master/ofcands.cpp

what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O
? argh!

---------- Forwarded message ----------
From: Matthew Gavin <>
Date: Fri, Aug 3, 2012 at 2:59 PM
Subject: Re: [Icpc-practice] challenge
To: Chris McKnight <>


rank 6th code =>
https://github.com/mgavin/acm-code/blob/master/ofcands.cpp

what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O
? argh!


On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>wrote:

> Starts learning assembly...
>
> Haha I'll look at the problem
>
> Chris McKnight
> Sent from my iPhone
>
> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:
>
> > Okay -- I got a challenge for y'all:
> >
> > I have solved the problem 10823: Of Circles and Squares
> >
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> > In fact, if you look at the statistics list I am the 5th fastest.
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
> >
> > So -- who can beat me?
> >
> > --
> > Isaac Traxler -- personal e-mail
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>



  #4  
03-08-2012 09:44 PM
Icpc-practice member admin is online now
User
 

Okay -- I got a challenge for y'all:

I have solved the problem 10823: Of Circles and Squares


http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764

In fact, if you look at the statistics list I am the 5th fastest.

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=

So -- who can beat me?

--
Isaac Traxler -- personal e-mail
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
Starts learning assembly...

Haha I'll look at the problem

Chris McKnight
Sent from my iPhone

On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:

> Okay -- I got a challenge for y'all:
>
> I have solved the problem 10823: Of Circles and Squares
>
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>
> In fact, if you look at the statistics list I am the 5th fastest.
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
> So -- who can beat me?
>
> --
> Isaac Traxler -- personal e-mail
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
rank 6th code =>
https://github.com/mgavin/acm-code/blob/master/ofcands.cpp

what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O
? argh!

---------- Forwarded message ----------
From: Matthew Gavin <>
Date: Fri, Aug 3, 2012 at 2:59 PM
Subject: Re: [Icpc-practice] challenge
To: Chris McKnight <>


rank 6th code =>
https://github.com/mgavin/acm-code/blob/master/ofcands.cpp

what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O
? argh!


On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>wrote:

> Starts learning assembly...
>
> Haha I'll look at the problem
>
> Chris McKnight
> Sent from my iPhone
>
> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:
>
> > Okay -- I got a challenge for y'all:
> >
> > I have solved the problem 10823: Of Circles and Squares
> >
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> > In fact, if you look at the statistics list I am the 5th fastest.
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
> >
> > So -- who can beat me?
> >
> > --
> > Isaac Traxler -- personal e-mail
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>


One small thing you ccan do is to avoid recomputing radius squared and teh
x+ length, y+ length. I added extra fields in my strcut and calculated all
of those values as I read it in sot hat when more than 1 query occurred,
it would not have to recompute.

I di dnot see you on the list, so I submitted your code and got a time of
.016

1) .010
2-5) .012
6) .014
7-13) .016

So it looks like you will show up 14th.

It also looks like the accuracy is to the nearest .002 of a second.

Maybe the suggestion above will buy you an increase -- but maybe not.

I am guessing that converting from c++ to c may buy you .002.

The only othr way I can think of to improve performance (for me also) is
to change the I/O method (scanf is pretty inefficient). I suspect that
.010 of my runtime is in the I/O and .002 is in the computation.

--
Isaac Traxler AIX,Linux Admin
Louisiana State University
High Performance Computing 225-578-1923
LONI AIX Clusters
AIX, Linux Support

On Fri, 3 Aug 2012, Matthew Gavin wrote:

> Date: Fri, 3 Aug 2012 19:59:52 +0000
> From: Matthew Gavin <>
> To: Chris McKnight <>
> Cc: icpc-
> Subject: Re: [Icpc-practice] challenge
>
> rank 6th code =>
> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>
> what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O ? argh!
>
> ---------- Forwarded message ----------
> From: Matthew Gavin <>
> Date: Fri, Aug 3, 2012 at 2:59 PM
> Subject: Re: [Icpc-practice] challenge
> To: Chris McKnight <>
>
>
> rank 6th code =>
> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>
> what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O ? argh!
>
> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <> wrote:
> Starts learning assembly...
>
> Haha I'll look at the problem
>
> Chris McKnight
> Sent from my iPhone
>
> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:
>
> > Okay -- I got a challenge for y'all:
> >
> > I have solved the problem 10823: Of Circles and Squares
> >
> >
> > http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> > In fact, if you look at the statistics list I am the 5th fastest.
> >
> >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
> >
> > So -- who can beat me?
> >
> > --
> > Isaac Traxler -- personal e-mail
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>
>
>
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)

  #5  
03-08-2012 10:37 PM
Icpc-practice member admin is online now
User
 

Okay -- I got a challenge for y'all:

I have solved the problem 10823: Of Circles and Squares


http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764

In fact, if you look at the statistics list I am the 5th fastest.

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=

So -- who can beat me?

--
Isaac Traxler -- personal e-mail
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
Starts learning assembly...

Haha I'll look at the problem

Chris McKnight
Sent from my iPhone

On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:

> Okay -- I got a challenge for y'all:
>
> I have solved the problem 10823: Of Circles and Squares
>
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>
> In fact, if you look at the statistics list I am the 5th fastest.
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
> So -- who can beat me?
>
> --
> Isaac Traxler -- personal e-mail
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
rank 6th code =>
https://github.com/mgavin/acm-code/blob/master/ofcands.cpp

what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O
? argh!

---------- Forwarded message ----------
From: Matthew Gavin <>
Date: Fri, Aug 3, 2012 at 2:59 PM
Subject: Re: [Icpc-practice] challenge
To: Chris McKnight <>


rank 6th code =>
https://github.com/mgavin/acm-code/blob/master/ofcands.cpp

what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O
? argh!


On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>wrote:

> Starts learning assembly...
>
> Haha I'll look at the problem
>
> Chris McKnight
> Sent from my iPhone
>
> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:
>
> > Okay -- I got a challenge for y'all:
> >
> > I have solved the problem 10823: Of Circles and Squares
> >
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> > In fact, if you look at the statistics list I am the 5th fastest.
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
> >
> > So -- who can beat me?
> >
> > --
> > Isaac Traxler -- personal e-mail
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>


One small thing you ccan do is to avoid recomputing radius squared and teh
x+ length, y+ length. I added extra fields in my strcut and calculated all
of those values as I read it in sot hat when more than 1 query occurred,
it would not have to recompute.

I di dnot see you on the list, so I submitted your code and got a time of
.016

1) .010
2-5) .012
6) .014
7-13) .016

So it looks like you will show up 14th.

It also looks like the accuracy is to the nearest .002 of a second.

Maybe the suggestion above will buy you an increase -- but maybe not.

I am guessing that converting from c++ to c may buy you .002.

The only othr way I can think of to improve performance (for me also) is
to change the I/O method (scanf is pretty inefficient). I suspect that
.010 of my runtime is in the I/O and .002 is in the computation.

--
Isaac Traxler AIX,Linux Admin
Louisiana State University
High Performance Computing 225-578-1923
LONI AIX Clusters
AIX, Linux Support

On Fri, 3 Aug 2012, Matthew Gavin wrote:

> Date: Fri, 3 Aug 2012 19:59:52 +0000
> From: Matthew Gavin <>
> To: Chris McKnight <>
> Cc: icpc-
> Subject: Re: [Icpc-practice] challenge
>
> rank 6th code =>
> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>
> what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O ? argh!
>
> ---------- Forwarded message ----------
> From: Matthew Gavin <>
> Date: Fri, Aug 3, 2012 at 2:59 PM
> Subject: Re: [Icpc-practice] challenge
> To: Chris McKnight <>
>
>
> rank 6th code =>
> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>
> what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O ? argh!
>
> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <> wrote:
> Starts learning assembly...
>
> Haha I'll look at the problem
>
> Chris McKnight
> Sent from my iPhone
>
> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:
>
> > Okay -- I got a challenge for y'all:
> >
> > I have solved the problem 10823: Of Circles and Squares
> >
> >
> > http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> > In fact, if you look at the statistics list I am the 5th fastest.
> >
> >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
> >
> > So -- who can beat me?
> >
> > --
> > Isaac Traxler -- personal e-mail
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>
>
>
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
hopefully their servers will get updated later. I've submitted like 20
times and it still says my best attempt was 0.036 run time... I'll see
about the precomputations and wonder later about storing the queries in an
array, but yeah, later.

I tried using fgets (which was supposed to cut time from scanf's superb
processing) but then I needed strtok and atoi to grab different values out
of the line. I'm not sure it added overhead, but when I submitted that code
to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
sure what could be cut out of I/O though =\

but yeah, til later.

On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:

> One small thing you ccan do is to avoid recomputing radius squared and teh
> x+ length, y+ length. I added extra fields in my strcut and calculated all
> of those values as I read it in sot hat when more than 1 query occurred, it
> would not have to recompute.
>
> I di dnot see you on the list, so I submitted your code and got a time of
> .016
>
> 1) .010
> 2-5) .012
> 6) .014
> 7-13) .016
>
> So it looks like you will show up 14th.
>
> It also looks like the accuracy is to the nearest .002 of a second.
>
> Maybe the suggestion above will buy you an increase -- but maybe not.
>
> I am guessing that converting from c++ to c may buy you .002.
>
> The only othr way I can think of to improve performance (for me also) is
> to change the I/O method (scanf is pretty inefficient). I suspect that .010
> of my runtime is in the I/O and .002 is in the computation.
>
> --
> Isaac Traxler AIX,Linux Admin
> Louisiana State University
> High Performance Computing 225-578-1923
> LONI AIX Clusters
> AIX, Linux Support
>
> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>
> Date: Fri, 3 Aug 2012 19:59:52 +0000
>> From: Matthew Gavin <>
>> To: Chris McKnight <>
>> Cc: icpc-
>> Subject: Re: [Icpc-practice] challenge
>>
>>
>> rank 6th code =>
>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>
>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>> I/O ? argh!
>>
>> ---------- Forwarded message ----------
>> From: Matthew Gavin <>
>> Date: Fri, Aug 3, 2012 at 2:59 PM
>> Subject: Re: [Icpc-practice] challenge
>> To: Chris McKnight <>
>>
>>
>> rank 6th code =>
>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>
>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>> I/O ? argh!
>>
>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>> wrote:
>> Starts learning assembly...
>>
>> Haha I'll look at the problem
>>
>> Chris McKnight
>> Sent from my iPhone
>>
>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>> wrote:
>>
>> > Okay -- I got a challenge for y'all:
>> >
>> > I have solved the problem 10823: Of Circles and Squares
>> >
>> >
>> > http://uva.onlinejudge.org/**index.php?option=com_**
>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>> >
>> > In fact, if you look at the statistics list I am the 5th fastest.
>> >
>> >http://uva.onlinejudge.org/**index.php?option=com_**
>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>
>> >
>> > So -- who can beat me?
>> >
>> > --
>> > Isaac Traxler -- personal e-mail
>> > ______________________________**_________________
>> > Icpc-practice mailing list
>> > Icpc-
>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>> ______________________________**_________________
>> Icpc-practice mailing list
>> Icpc-
>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>
>>
>>
>>
>>
>>



  #6  
04-08-2012 05:52 PM
Icpc-practice member admin is online now
User
 

Okay -- I got a challenge for y'all:

I have solved the problem 10823: Of Circles and Squares


http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764

In fact, if you look at the statistics list I am the 5th fastest.

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=

So -- who can beat me?

--
Isaac Traxler -- personal e-mail
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
Starts learning assembly...

Haha I'll look at the problem

Chris McKnight
Sent from my iPhone

On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:

> Okay -- I got a challenge for y'all:
>
> I have solved the problem 10823: Of Circles and Squares
>
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>
> In fact, if you look at the statistics list I am the 5th fastest.
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
> So -- who can beat me?
>
> --
> Isaac Traxler -- personal e-mail
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
rank 6th code =>
https://github.com/mgavin/acm-code/blob/master/ofcands.cpp

what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O
? argh!

---------- Forwarded message ----------
From: Matthew Gavin <>
Date: Fri, Aug 3, 2012 at 2:59 PM
Subject: Re: [Icpc-practice] challenge
To: Chris McKnight <>


rank 6th code =>
https://github.com/mgavin/acm-code/blob/master/ofcands.cpp

what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O
? argh!


On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>wrote:

> Starts learning assembly...
>
> Haha I'll look at the problem
>
> Chris McKnight
> Sent from my iPhone
>
> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:
>
> > Okay -- I got a challenge for y'all:
> >
> > I have solved the problem 10823: Of Circles and Squares
> >
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> > In fact, if you look at the statistics list I am the 5th fastest.
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
> >
> > So -- who can beat me?
> >
> > --
> > Isaac Traxler -- personal e-mail
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>


One small thing you ccan do is to avoid recomputing radius squared and teh
x+ length, y+ length. I added extra fields in my strcut and calculated all
of those values as I read it in sot hat when more than 1 query occurred,
it would not have to recompute.

I di dnot see you on the list, so I submitted your code and got a time of
.016

1) .010
2-5) .012
6) .014
7-13) .016

So it looks like you will show up 14th.

It also looks like the accuracy is to the nearest .002 of a second.

Maybe the suggestion above will buy you an increase -- but maybe not.

I am guessing that converting from c++ to c may buy you .002.

The only othr way I can think of to improve performance (for me also) is
to change the I/O method (scanf is pretty inefficient). I suspect that
.010 of my runtime is in the I/O and .002 is in the computation.

--
Isaac Traxler AIX,Linux Admin
Louisiana State University
High Performance Computing 225-578-1923
LONI AIX Clusters
AIX, Linux Support

On Fri, 3 Aug 2012, Matthew Gavin wrote:

> Date: Fri, 3 Aug 2012 19:59:52 +0000
> From: Matthew Gavin <>
> To: Chris McKnight <>
> Cc: icpc-
> Subject: Re: [Icpc-practice] challenge
>
> rank 6th code =>
> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>
> what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O ? argh!
>
> ---------- Forwarded message ----------
> From: Matthew Gavin <>
> Date: Fri, Aug 3, 2012 at 2:59 PM
> Subject: Re: [Icpc-practice] challenge
> To: Chris McKnight <>
>
>
> rank 6th code =>
> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>
> what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O ? argh!
>
> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <> wrote:
> Starts learning assembly...
>
> Haha I'll look at the problem
>
> Chris McKnight
> Sent from my iPhone
>
> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:
>
> > Okay -- I got a challenge for y'all:
> >
> > I have solved the problem 10823: Of Circles and Squares
> >
> >
> > http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> > In fact, if you look at the statistics list I am the 5th fastest.
> >
> >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
> >
> > So -- who can beat me?
> >
> > --
> > Isaac Traxler -- personal e-mail
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>
>
>
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
hopefully their servers will get updated later. I've submitted like 20
times and it still says my best attempt was 0.036 run time... I'll see
about the precomputations and wonder later about storing the queries in an
array, but yeah, later.

I tried using fgets (which was supposed to cut time from scanf's superb
processing) but then I needed strtok and atoi to grab different values out
of the line. I'm not sure it added overhead, but when I submitted that code
to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
sure what could be cut out of I/O though =\

but yeah, til later.

On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:

> One small thing you ccan do is to avoid recomputing radius squared and teh
> x+ length, y+ length. I added extra fields in my strcut and calculated all
> of those values as I read it in sot hat when more than 1 query occurred, it
> would not have to recompute.
>
> I di dnot see you on the list, so I submitted your code and got a time of
> .016
>
> 1) .010
> 2-5) .012
> 6) .014
> 7-13) .016
>
> So it looks like you will show up 14th.
>
> It also looks like the accuracy is to the nearest .002 of a second.
>
> Maybe the suggestion above will buy you an increase -- but maybe not.
>
> I am guessing that converting from c++ to c may buy you .002.
>
> The only othr way I can think of to improve performance (for me also) is
> to change the I/O method (scanf is pretty inefficient). I suspect that .010
> of my runtime is in the I/O and .002 is in the computation.
>
> --
> Isaac Traxler AIX,Linux Admin
> Louisiana State University
> High Performance Computing 225-578-1923
> LONI AIX Clusters
> AIX, Linux Support
>
> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>
> Date: Fri, 3 Aug 2012 19:59:52 +0000
>> From: Matthew Gavin <>
>> To: Chris McKnight <>
>> Cc: icpc-
>> Subject: Re: [Icpc-practice] challenge
>>
>>
>> rank 6th code =>
>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>
>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>> I/O ? argh!
>>
>> ---------- Forwarded message ----------
>> From: Matthew Gavin <>
>> Date: Fri, Aug 3, 2012 at 2:59 PM
>> Subject: Re: [Icpc-practice] challenge
>> To: Chris McKnight <>
>>
>>
>> rank 6th code =>
>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>
>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>> I/O ? argh!
>>
>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>> wrote:
>> Starts learning assembly...
>>
>> Haha I'll look at the problem
>>
>> Chris McKnight
>> Sent from my iPhone
>>
>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>> wrote:
>>
>> > Okay -- I got a challenge for y'all:
>> >
>> > I have solved the problem 10823: Of Circles and Squares
>> >
>> >
>> > http://uva.onlinejudge.org/**index.php?option=com_**
>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>> >
>> > In fact, if you look at the statistics list I am the 5th fastest.
>> >
>> >http://uva.onlinejudge.org/**index.php?option=com_**
>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>
>> >
>> > So -- who can beat me?
>> >
>> > --
>> > Isaac Traxler -- personal e-mail
>> > ______________________________**_________________
>> > Icpc-practice mailing list
>> > Icpc-
>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>> ______________________________**_________________
>> Icpc-practice mailing list
>> Icpc-
>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>
>>
>>
>>
>>
>>


On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>
> See! I told you ;). 6th.
>
> I wish there were a book on like the lower internals of the system, and
> how to create extremely efficient code and what pitfalls to look for when
> using different methods in C/C++...
> but maybe that information just comes with the teachings of theory in
> higher level CS courses? :\
>
>
> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>
>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>> hopefully their servers will get updated later. I've submitted like 20
>> times and it still says my best attempt was 0.036 run time... I'll see
>> about the precomputations and wonder later about storing the queries in an
>> array, but yeah, later.
>>
>> I tried using fgets (which was supposed to cut time from scanf's superb
>> processing) but then I needed strtok and atoi to grab different values out
>> of the line. I'm not sure it added overhead, but when I submitted that code
>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>> sure what could be cut out of I/O though =\
>>
>> but yeah, til later.
>>
>>
>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>
>>> One small thing you ccan do is to avoid recomputing radius squared and
>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>> all of those values as I read it in sot hat when more than 1 query
>>> occurred, it would not have to recompute.
>>>
>>> I di dnot see you on the list, so I submitted your code and got a time
>>> of .016
>>>
>>> 1) .010
>>> 2-5) .012
>>> 6) .014
>>> 7-13) .016
>>>
>>> So it looks like you will show up 14th.
>>>
>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>
>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>
>>> I am guessing that converting from c++ to c may buy you .002.
>>>
>>> The only othr way I can think of to improve performance (for me also) is
>>> to change the I/O method (scanf is pretty inefficient). I suspect that .010
>>> of my runtime is in the I/O and .002 is in the computation.
>>>
>>> --
>>> Isaac Traxler AIX,Linux Admin
>>> Louisiana State University
>>> High Performance Computing 225-578-1923
>>> LONI AIX Clusters
>>> AIX, Linux Support
>>>
>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>
>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>> From: Matthew Gavin <>
>>>> To: Chris McKnight <>
>>>> Cc: icpc-
>>>> Subject: Re: [Icpc-practice] challenge
>>>>
>>>>
>>>> rank 6th code =>
>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>
>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>> I/O ? argh!
>>>>
>>>> ---------- Forwarded message ----------
>>>> From: Matthew Gavin <>
>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>> Subject: Re: [Icpc-practice] challenge
>>>> To: Chris McKnight <>
>>>>
>>>>
>>>> rank 6th code =>
>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>
>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>> I/O ? argh!
>>>>
>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>> wrote:
>>>> Starts learning assembly...
>>>>
>>>> Haha I'll look at the problem
>>>>
>>>> Chris McKnight
>>>> Sent from my iPhone
>>>>
>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>> wrote:
>>>>
>>>> > Okay -- I got a challenge for y'all:
>>>> >
>>>> > I have solved the problem 10823: Of Circles and Squares
>>>> >
>>>> >
>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>> >
>>>> > In fact, if you look at the statistics list I am the 5th
>>>> fastest.
>>>> >
>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>
>>>> >
>>>> > So -- who can beat me?
>>>> >
>>>> > --
>>>> > Isaac Traxler -- personal e-mail
>>>> > ______________________________**_________________
>>>> > Icpc-practice mailing list
>>>> > Icpc-
>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>> ______________________________**_________________
>>>> Icpc-practice mailing list
>>>> Icpc-
>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>
>



  #7  
04-08-2012 07:52 PM
Icpc-practice member admin is online now
User
 

Okay -- I got a challenge for y'all:

I have solved the problem 10823: Of Circles and Squares


http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764

In fact, if you look at the statistics list I am the 5th fastest.

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=

So -- who can beat me?

--
Isaac Traxler -- personal e-mail
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
Starts learning assembly...

Haha I'll look at the problem

Chris McKnight
Sent from my iPhone

On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:

> Okay -- I got a challenge for y'all:
>
> I have solved the problem 10823: Of Circles and Squares
>
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>
> In fact, if you look at the statistics list I am the 5th fastest.
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
> So -- who can beat me?
>
> --
> Isaac Traxler -- personal e-mail
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
rank 6th code =>
https://github.com/mgavin/acm-code/blob/master/ofcands.cpp

what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O
? argh!

---------- Forwarded message ----------
From: Matthew Gavin <>
Date: Fri, Aug 3, 2012 at 2:59 PM
Subject: Re: [Icpc-practice] challenge
To: Chris McKnight <>


rank 6th code =>
https://github.com/mgavin/acm-code/blob/master/ofcands.cpp

what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O
? argh!


On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>wrote:

> Starts learning assembly...
>
> Haha I'll look at the problem
>
> Chris McKnight
> Sent from my iPhone
>
> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:
>
> > Okay -- I got a challenge for y'all:
> >
> > I have solved the problem 10823: Of Circles and Squares
> >
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> > In fact, if you look at the statistics list I am the 5th fastest.
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
> >
> > So -- who can beat me?
> >
> > --
> > Isaac Traxler -- personal e-mail
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>


One small thing you ccan do is to avoid recomputing radius squared and teh
x+ length, y+ length. I added extra fields in my strcut and calculated all
of those values as I read it in sot hat when more than 1 query occurred,
it would not have to recompute.

I di dnot see you on the list, so I submitted your code and got a time of
.016

1) .010
2-5) .012
6) .014
7-13) .016

So it looks like you will show up 14th.

It also looks like the accuracy is to the nearest .002 of a second.

Maybe the suggestion above will buy you an increase -- but maybe not.

I am guessing that converting from c++ to c may buy you .002.

The only othr way I can think of to improve performance (for me also) is
to change the I/O method (scanf is pretty inefficient). I suspect that
.010 of my runtime is in the I/O and .002 is in the computation.

--
Isaac Traxler AIX,Linux Admin
Louisiana State University
High Performance Computing 225-578-1923
LONI AIX Clusters
AIX, Linux Support

On Fri, 3 Aug 2012, Matthew Gavin wrote:

> Date: Fri, 3 Aug 2012 19:59:52 +0000
> From: Matthew Gavin <>
> To: Chris McKnight <>
> Cc: icpc-
> Subject: Re: [Icpc-practice] challenge
>
> rank 6th code =>
> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>
> what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O ? argh!
>
> ---------- Forwarded message ----------
> From: Matthew Gavin <>
> Date: Fri, Aug 3, 2012 at 2:59 PM
> Subject: Re: [Icpc-practice] challenge
> To: Chris McKnight <>
>
>
> rank 6th code =>
> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>
> what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O ? argh!
>
> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <> wrote:
> Starts learning assembly...
>
> Haha I'll look at the problem
>
> Chris McKnight
> Sent from my iPhone
>
> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:
>
> > Okay -- I got a challenge for y'all:
> >
> > I have solved the problem 10823: Of Circles and Squares
> >
> >
> > http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> > In fact, if you look at the statistics list I am the 5th fastest.
> >
> >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
> >
> > So -- who can beat me?
> >
> > --
> > Isaac Traxler -- personal e-mail
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>
>
>
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
hopefully their servers will get updated later. I've submitted like 20
times and it still says my best attempt was 0.036 run time... I'll see
about the precomputations and wonder later about storing the queries in an
array, but yeah, later.

I tried using fgets (which was supposed to cut time from scanf's superb
processing) but then I needed strtok and atoi to grab different values out
of the line. I'm not sure it added overhead, but when I submitted that code
to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
sure what could be cut out of I/O though =\

but yeah, til later.

On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:

> One small thing you ccan do is to avoid recomputing radius squared and teh
> x+ length, y+ length. I added extra fields in my strcut and calculated all
> of those values as I read it in sot hat when more than 1 query occurred, it
> would not have to recompute.
>
> I di dnot see you on the list, so I submitted your code and got a time of
> .016
>
> 1) .010
> 2-5) .012
> 6) .014
> 7-13) .016
>
> So it looks like you will show up 14th.
>
> It also looks like the accuracy is to the nearest .002 of a second.
>
> Maybe the suggestion above will buy you an increase -- but maybe not.
>
> I am guessing that converting from c++ to c may buy you .002.
>
> The only othr way I can think of to improve performance (for me also) is
> to change the I/O method (scanf is pretty inefficient). I suspect that .010
> of my runtime is in the I/O and .002 is in the computation.
>
> --
> Isaac Traxler AIX,Linux Admin
> Louisiana State University
> High Performance Computing 225-578-1923
> LONI AIX Clusters
> AIX, Linux Support
>
> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>
> Date: Fri, 3 Aug 2012 19:59:52 +0000
>> From: Matthew Gavin <>
>> To: Chris McKnight <>
>> Cc: icpc-
>> Subject: Re: [Icpc-practice] challenge
>>
>>
>> rank 6th code =>
>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>
>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>> I/O ? argh!
>>
>> ---------- Forwarded message ----------
>> From: Matthew Gavin <>
>> Date: Fri, Aug 3, 2012 at 2:59 PM
>> Subject: Re: [Icpc-practice] challenge
>> To: Chris McKnight <>
>>
>>
>> rank 6th code =>
>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>
>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>> I/O ? argh!
>>
>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>> wrote:
>> Starts learning assembly...
>>
>> Haha I'll look at the problem
>>
>> Chris McKnight
>> Sent from my iPhone
>>
>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>> wrote:
>>
>> > Okay -- I got a challenge for y'all:
>> >
>> > I have solved the problem 10823: Of Circles and Squares
>> >
>> >
>> > http://uva.onlinejudge.org/**index.php?option=com_**
>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>> >
>> > In fact, if you look at the statistics list I am the 5th fastest.
>> >
>> >http://uva.onlinejudge.org/**index.php?option=com_**
>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>
>> >
>> > So -- who can beat me?
>> >
>> > --
>> > Isaac Traxler -- personal e-mail
>> > ______________________________**_________________
>> > Icpc-practice mailing list
>> > Icpc-
>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>> ______________________________**_________________
>> Icpc-practice mailing list
>> Icpc-
>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>
>>
>>
>>
>>
>>


On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>
> See! I told you ;). 6th.
>
> I wish there were a book on like the lower internals of the system, and
> how to create extremely efficient code and what pitfalls to look for when
> using different methods in C/C++...
> but maybe that information just comes with the teachings of theory in
> higher level CS courses? :\
>
>
> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>
>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>> hopefully their servers will get updated later. I've submitted like 20
>> times and it still says my best attempt was 0.036 run time... I'll see
>> about the precomputations and wonder later about storing the queries in an
>> array, but yeah, later.
>>
>> I tried using fgets (which was supposed to cut time from scanf's superb
>> processing) but then I needed strtok and atoi to grab different values out
>> of the line. I'm not sure it added overhead, but when I submitted that code
>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>> sure what could be cut out of I/O though =\
>>
>> but yeah, til later.
>>
>>
>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>
>>> One small thing you ccan do is to avoid recomputing radius squared and
>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>> all of those values as I read it in sot hat when more than 1 query
>>> occurred, it would not have to recompute.
>>>
>>> I di dnot see you on the list, so I submitted your code and got a time
>>> of .016
>>>
>>> 1) .010
>>> 2-5) .012
>>> 6) .014
>>> 7-13) .016
>>>
>>> So it looks like you will show up 14th.
>>>
>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>
>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>
>>> I am guessing that converting from c++ to c may buy you .002.
>>>
>>> The only othr way I can think of to improve performance (for me also) is
>>> to change the I/O method (scanf is pretty inefficient). I suspect that .010
>>> of my runtime is in the I/O and .002 is in the computation.
>>>
>>> --
>>> Isaac Traxler AIX,Linux Admin
>>> Louisiana State University
>>> High Performance Computing 225-578-1923
>>> LONI AIX Clusters
>>> AIX, Linux Support
>>>
>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>
>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>> From: Matthew Gavin <>
>>>> To: Chris McKnight <>
>>>> Cc: icpc-
>>>> Subject: Re: [Icpc-practice] challenge
>>>>
>>>>
>>>> rank 6th code =>
>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>
>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>> I/O ? argh!
>>>>
>>>> ---------- Forwarded message ----------
>>>> From: Matthew Gavin <>
>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>> Subject: Re: [Icpc-practice] challenge
>>>> To: Chris McKnight <>
>>>>
>>>>
>>>> rank 6th code =>
>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>
>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>> I/O ? argh!
>>>>
>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>> wrote:
>>>> Starts learning assembly...
>>>>
>>>> Haha I'll look at the problem
>>>>
>>>> Chris McKnight
>>>> Sent from my iPhone
>>>>
>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>> wrote:
>>>>
>>>> > Okay -- I got a challenge for y'all:
>>>> >
>>>> > I have solved the problem 10823: Of Circles and Squares
>>>> >
>>>> >
>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>> >
>>>> > In fact, if you look at the statistics list I am the 5th
>>>> fastest.
>>>> >
>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>
>>>> >
>>>> > So -- who can beat me?
>>>> >
>>>> > --
>>>> > Isaac Traxler -- personal e-mail
>>>> > ______________________________**_________________
>>>> > Icpc-practice mailing list
>>>> > Icpc-
>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>> ______________________________**_________________
>>>> Icpc-practice mailing list
>>>> Icpc-
>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>
>


https://raw.github.com/mgavin/acm-code/master/ofcands.c

bit shifts instead of *2, goto's..., compiling in c, no point struct...,
pre-computing px+length and py+length instead of doing it twice.. :\

still 0.12

I don't know anymore...

On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>
>>
>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>
>> See! I told you ;). 6th.
>>
>> I wish there were a book on like the lower internals of the system, and
>> how to create extremely efficient code and what pitfalls to look for when
>> using different methods in C/C++...
>> but maybe that information just comes with the teachings of theory in
>> higher level CS courses? :\
>>
>>
>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>>
>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>>> hopefully their servers will get updated later. I've submitted like 20
>>> times and it still says my best attempt was 0.036 run time... I'll see
>>> about the precomputations and wonder later about storing the queries in an
>>> array, but yeah, later.
>>>
>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>> processing) but then I needed strtok and atoi to grab different values out
>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>> sure what could be cut out of I/O though =\
>>>
>>> but yeah, til later.
>>>
>>>
>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>>
>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>> all of those values as I read it in sot hat when more than 1 query
>>>> occurred, it would not have to recompute.
>>>>
>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>> of .016
>>>>
>>>> 1) .010
>>>> 2-5) .012
>>>> 6) .014
>>>> 7-13) .016
>>>>
>>>> So it looks like you will show up 14th.
>>>>
>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>
>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>
>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>
>>>> The only othr way I can think of to improve performance (for me also)
>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>
>>>> --
>>>> Isaac Traxler AIX,Linux Admin
>>>> Louisiana State University
>>>> High Performance Computing 225-578-1923
>>>> LONI AIX Clusters
>>>> AIX, Linux Support
>>>>
>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>
>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>> From: Matthew Gavin <>
>>>>> To: Chris McKnight <>
>>>>> Cc: icpc-
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> ---------- Forwarded message ----------
>>>>> From: Matthew Gavin <>
>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>> To: Chris McKnight <>
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>>> wrote:
>>>>> Starts learning assembly...
>>>>>
>>>>> Haha I'll look at the problem
>>>>>
>>>>> Chris McKnight
>>>>> Sent from my iPhone
>>>>>
>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>> wrote:
>>>>>
>>>>> > Okay -- I got a challenge for y'all:
>>>>> >
>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>> >
>>>>> >
>>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>>> >
>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>> fastest.
>>>>> >
>>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>>
>>>>> >
>>>>> > So -- who can beat me?
>>>>> >
>>>>> > --
>>>>> > Isaac Traxler -- personal e-mail
>>>>> > ______________________________**_________________
>>>>> > Icpc-practice mailing list
>>>>> > Icpc-
>>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>> ______________________________**_________________
>>>>> Icpc-practice mailing list
>>>>> Icpc-
>>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>
>



  #8  
04-08-2012 08:00 PM
Icpc-practice member admin is online now
User
 

Okay -- I got a challenge for y'all:

I have solved the problem 10823: Of Circles and Squares


http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764

In fact, if you look at the statistics list I am the 5th fastest.

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=

So -- who can beat me?

--
Isaac Traxler -- personal e-mail
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
Starts learning assembly...

Haha I'll look at the problem

Chris McKnight
Sent from my iPhone

On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:

> Okay -- I got a challenge for y'all:
>
> I have solved the problem 10823: Of Circles and Squares
>
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>
> In fact, if you look at the statistics list I am the 5th fastest.
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
> So -- who can beat me?
>
> --
> Isaac Traxler -- personal e-mail
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
rank 6th code =>
https://github.com/mgavin/acm-code/blob/master/ofcands.cpp

what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O
? argh!

---------- Forwarded message ----------
From: Matthew Gavin <>
Date: Fri, Aug 3, 2012 at 2:59 PM
Subject: Re: [Icpc-practice] challenge
To: Chris McKnight <>


rank 6th code =>
https://github.com/mgavin/acm-code/blob/master/ofcands.cpp

what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O
? argh!


On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>wrote:

> Starts learning assembly...
>
> Haha I'll look at the problem
>
> Chris McKnight
> Sent from my iPhone
>
> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:
>
> > Okay -- I got a challenge for y'all:
> >
> > I have solved the problem 10823: Of Circles and Squares
> >
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> > In fact, if you look at the statistics list I am the 5th fastest.
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
> >
> > So -- who can beat me?
> >
> > --
> > Isaac Traxler -- personal e-mail
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>


One small thing you ccan do is to avoid recomputing radius squared and teh
x+ length, y+ length. I added extra fields in my strcut and calculated all
of those values as I read it in sot hat when more than 1 query occurred,
it would not have to recompute.

I di dnot see you on the list, so I submitted your code and got a time of
.016

1) .010
2-5) .012
6) .014
7-13) .016

So it looks like you will show up 14th.

It also looks like the accuracy is to the nearest .002 of a second.

Maybe the suggestion above will buy you an increase -- but maybe not.

I am guessing that converting from c++ to c may buy you .002.

The only othr way I can think of to improve performance (for me also) is
to change the I/O method (scanf is pretty inefficient). I suspect that
.010 of my runtime is in the I/O and .002 is in the computation.

--
Isaac Traxler AIX,Linux Admin
Louisiana State University
High Performance Computing 225-578-1923
LONI AIX Clusters
AIX, Linux Support

On Fri, 3 Aug 2012, Matthew Gavin wrote:

> Date: Fri, 3 Aug 2012 19:59:52 +0000
> From: Matthew Gavin <>
> To: Chris McKnight <>
> Cc: icpc-
> Subject: Re: [Icpc-practice] challenge
>
> rank 6th code =>
> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>
> what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O ? argh!
>
> ---------- Forwarded message ----------
> From: Matthew Gavin <>
> Date: Fri, Aug 3, 2012 at 2:59 PM
> Subject: Re: [Icpc-practice] challenge
> To: Chris McKnight <>
>
>
> rank 6th code =>
> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>
> what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O ? argh!
>
> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <> wrote:
> Starts learning assembly...
>
> Haha I'll look at the problem
>
> Chris McKnight
> Sent from my iPhone
>
> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:
>
> > Okay -- I got a challenge for y'all:
> >
> > I have solved the problem 10823: Of Circles and Squares
> >
> >
> > http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> > In fact, if you look at the statistics list I am the 5th fastest.
> >
> >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
> >
> > So -- who can beat me?
> >
> > --
> > Isaac Traxler -- personal e-mail
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>
>
>
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
hopefully their servers will get updated later. I've submitted like 20
times and it still says my best attempt was 0.036 run time... I'll see
about the precomputations and wonder later about storing the queries in an
array, but yeah, later.

I tried using fgets (which was supposed to cut time from scanf's superb
processing) but then I needed strtok and atoi to grab different values out
of the line. I'm not sure it added overhead, but when I submitted that code
to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
sure what could be cut out of I/O though =\

but yeah, til later.

On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:

> One small thing you ccan do is to avoid recomputing radius squared and teh
> x+ length, y+ length. I added extra fields in my strcut and calculated all
> of those values as I read it in sot hat when more than 1 query occurred, it
> would not have to recompute.
>
> I di dnot see you on the list, so I submitted your code and got a time of
> .016
>
> 1) .010
> 2-5) .012
> 6) .014
> 7-13) .016
>
> So it looks like you will show up 14th.
>
> It also looks like the accuracy is to the nearest .002 of a second.
>
> Maybe the suggestion above will buy you an increase -- but maybe not.
>
> I am guessing that converting from c++ to c may buy you .002.
>
> The only othr way I can think of to improve performance (for me also) is
> to change the I/O method (scanf is pretty inefficient). I suspect that .010
> of my runtime is in the I/O and .002 is in the computation.
>
> --
> Isaac Traxler AIX,Linux Admin
> Louisiana State University
> High Performance Computing 225-578-1923
> LONI AIX Clusters
> AIX, Linux Support
>
> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>
> Date: Fri, 3 Aug 2012 19:59:52 +0000
>> From: Matthew Gavin <>
>> To: Chris McKnight <>
>> Cc: icpc-
>> Subject: Re: [Icpc-practice] challenge
>>
>>
>> rank 6th code =>
>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>
>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>> I/O ? argh!
>>
>> ---------- Forwarded message ----------
>> From: Matthew Gavin <>
>> Date: Fri, Aug 3, 2012 at 2:59 PM
>> Subject: Re: [Icpc-practice] challenge
>> To: Chris McKnight <>
>>
>>
>> rank 6th code =>
>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>
>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>> I/O ? argh!
>>
>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>> wrote:
>> Starts learning assembly...
>>
>> Haha I'll look at the problem
>>
>> Chris McKnight
>> Sent from my iPhone
>>
>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>> wrote:
>>
>> > Okay -- I got a challenge for y'all:
>> >
>> > I have solved the problem 10823: Of Circles and Squares
>> >
>> >
>> > http://uva.onlinejudge.org/**index.php?option=com_**
>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>> >
>> > In fact, if you look at the statistics list I am the 5th fastest.
>> >
>> >http://uva.onlinejudge.org/**index.php?option=com_**
>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>
>> >
>> > So -- who can beat me?
>> >
>> > --
>> > Isaac Traxler -- personal e-mail
>> > ______________________________**_________________
>> > Icpc-practice mailing list
>> > Icpc-
>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>> ______________________________**_________________
>> Icpc-practice mailing list
>> Icpc-
>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>
>>
>>
>>
>>
>>


On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>
> See! I told you ;). 6th.
>
> I wish there were a book on like the lower internals of the system, and
> how to create extremely efficient code and what pitfalls to look for when
> using different methods in C/C++...
> but maybe that information just comes with the teachings of theory in
> higher level CS courses? :\
>
>
> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>
>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>> hopefully their servers will get updated later. I've submitted like 20
>> times and it still says my best attempt was 0.036 run time... I'll see
>> about the precomputations and wonder later about storing the queries in an
>> array, but yeah, later.
>>
>> I tried using fgets (which was supposed to cut time from scanf's superb
>> processing) but then I needed strtok and atoi to grab different values out
>> of the line. I'm not sure it added overhead, but when I submitted that code
>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>> sure what could be cut out of I/O though =\
>>
>> but yeah, til later.
>>
>>
>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>
>>> One small thing you ccan do is to avoid recomputing radius squared and
>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>> all of those values as I read it in sot hat when more than 1 query
>>> occurred, it would not have to recompute.
>>>
>>> I di dnot see you on the list, so I submitted your code and got a time
>>> of .016
>>>
>>> 1) .010
>>> 2-5) .012
>>> 6) .014
>>> 7-13) .016
>>>
>>> So it looks like you will show up 14th.
>>>
>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>
>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>
>>> I am guessing that converting from c++ to c may buy you .002.
>>>
>>> The only othr way I can think of to improve performance (for me also) is
>>> to change the I/O method (scanf is pretty inefficient). I suspect that .010
>>> of my runtime is in the I/O and .002 is in the computation.
>>>
>>> --
>>> Isaac Traxler AIX,Linux Admin
>>> Louisiana State University
>>> High Performance Computing 225-578-1923
>>> LONI AIX Clusters
>>> AIX, Linux Support
>>>
>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>
>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>> From: Matthew Gavin <>
>>>> To: Chris McKnight <>
>>>> Cc: icpc-
>>>> Subject: Re: [Icpc-practice] challenge
>>>>
>>>>
>>>> rank 6th code =>
>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>
>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>> I/O ? argh!
>>>>
>>>> ---------- Forwarded message ----------
>>>> From: Matthew Gavin <>
>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>> Subject: Re: [Icpc-practice] challenge
>>>> To: Chris McKnight <>
>>>>
>>>>
>>>> rank 6th code =>
>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>
>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>> I/O ? argh!
>>>>
>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>> wrote:
>>>> Starts learning assembly...
>>>>
>>>> Haha I'll look at the problem
>>>>
>>>> Chris McKnight
>>>> Sent from my iPhone
>>>>
>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>> wrote:
>>>>
>>>> > Okay -- I got a challenge for y'all:
>>>> >
>>>> > I have solved the problem 10823: Of Circles and Squares
>>>> >
>>>> >
>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>> >
>>>> > In fact, if you look at the statistics list I am the 5th
>>>> fastest.
>>>> >
>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>
>>>> >
>>>> > So -- who can beat me?
>>>> >
>>>> > --
>>>> > Isaac Traxler -- personal e-mail
>>>> > ______________________________**_________________
>>>> > Icpc-practice mailing list
>>>> > Icpc-
>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>> ______________________________**_________________
>>>> Icpc-practice mailing list
>>>> Icpc-
>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>
>


https://raw.github.com/mgavin/acm-code/master/ofcands.c

bit shifts instead of *2, goto's..., compiling in c, no point struct...,
pre-computing px+length and py+length instead of doing it twice.. :\

still 0.12

I don't know anymore...

On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>
>>
>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>
>> See! I told you ;). 6th.
>>
>> I wish there were a book on like the lower internals of the system, and
>> how to create extremely efficient code and what pitfalls to look for when
>> using different methods in C/C++...
>> but maybe that information just comes with the teachings of theory in
>> higher level CS courses? :\
>>
>>
>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>>
>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>>> hopefully their servers will get updated later. I've submitted like 20
>>> times and it still says my best attempt was 0.036 run time... I'll see
>>> about the precomputations and wonder later about storing the queries in an
>>> array, but yeah, later.
>>>
>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>> processing) but then I needed strtok and atoi to grab different values out
>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>> sure what could be cut out of I/O though =\
>>>
>>> but yeah, til later.
>>>
>>>
>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>>
>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>> all of those values as I read it in sot hat when more than 1 query
>>>> occurred, it would not have to recompute.
>>>>
>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>> of .016
>>>>
>>>> 1) .010
>>>> 2-5) .012
>>>> 6) .014
>>>> 7-13) .016
>>>>
>>>> So it looks like you will show up 14th.
>>>>
>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>
>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>
>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>
>>>> The only othr way I can think of to improve performance (for me also)
>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>
>>>> --
>>>> Isaac Traxler AIX,Linux Admin
>>>> Louisiana State University
>>>> High Performance Computing 225-578-1923
>>>> LONI AIX Clusters
>>>> AIX, Linux Support
>>>>
>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>
>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>> From: Matthew Gavin <>
>>>>> To: Chris McKnight <>
>>>>> Cc: icpc-
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> ---------- Forwarded message ----------
>>>>> From: Matthew Gavin <>
>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>> To: Chris McKnight <>
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>>> wrote:
>>>>> Starts learning assembly...
>>>>>
>>>>> Haha I'll look at the problem
>>>>>
>>>>> Chris McKnight
>>>>> Sent from my iPhone
>>>>>
>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>> wrote:
>>>>>
>>>>> > Okay -- I got a challenge for y'all:
>>>>> >
>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>> >
>>>>> >
>>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>>> >
>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>> fastest.
>>>>> >
>>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>>
>>>>> >
>>>>> > So -- who can beat me?
>>>>> >
>>>>> > --
>>>>> > Isaac Traxler -- personal e-mail
>>>>> > ______________________________**_________________
>>>>> > Icpc-practice mailing list
>>>>> > Icpc-
>>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>> ______________________________**_________________
>>>>> Icpc-practice mailing list
>>>>> Icpc-
>>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>
>


That seems to suggest what Isaac said the other day: The majority of
the time is spent handling input/output rather than in computation.

On Sat, Aug 4, 2012 at 1:52 PM, Matthew Gavin <> wrote:
> https://raw.github.com/mgavin/acm-code/master/ofcands.c
>
> bit shifts instead of *2, goto's..., compiling in c, no point struct...,
> pre-computing px+length and py+length instead of doing it twice.. :\
>
> still 0.12
>
> I don't know anymore...
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>
> wrote:
>>
>>
>>
>> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>
>> wrote:
>>>
>>>
>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>>
>>> See! I told you ;). 6th.
>>>
>>> I wish there were a book on like the lower internals of the system, and
>>> how to create extremely efficient code and what pitfalls to look for when
>>> using different methods in C/C++...
>>> but maybe that information just comes with the teachings of theory in
>>> higher level CS courses? :\
>>>
>>>
>>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>
>>> wrote:
>>>>
>>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>>>> hopefully their servers will get updated later. I've submitted like 20 times
>>>> and it still says my best attempt was 0.036 run time... I'll see about the
>>>> precomputations and wonder later about storing the queries in an array, but
>>>> yeah, later.
>>>>
>>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>>> processing) but then I needed strtok and atoi to grab different values out
>>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>>> sure what could be cut out of I/O though =\
>>>>
>>>> but yeah, til later.
>>>>
>>>>
>>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>>>>
>>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>>> all of those values as I read it in sot hat when more than 1 query occurred,
>>>>> it would not have to recompute.
>>>>>
>>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>>> of .016
>>>>>
>>>>> 1) .010
>>>>> 2-5) .012
>>>>> 6) .014
>>>>> 7-13) .016
>>>>>
>>>>> So it looks like you will show up 14th.
>>>>>
>>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>>
>>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>>
>>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>>
>>>>> The only othr way I can think of to improve performance (for me also)
>>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>>
>>>>> --
>>>>> Isaac Traxler AIX,Linux Admin
>>>>> Louisiana State University
>>>>> High Performance Computing 225-578-1923
>>>>> LONI AIX Clusters
>>>>> AIX, Linux Support
>>>>>
>>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>>
>>>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>>> From: Matthew Gavin <>
>>>>>> To: Chris McKnight <>
>>>>>> Cc: icpc-
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>>> I/O ? argh!
>>>>>>
>>>>>> ---------- Forwarded message ----------
>>>>>> From: Matthew Gavin <>
>>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>> To: Chris McKnight <>
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>>> I/O ? argh!
>>>>>>
>>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight
>>>>>> <> wrote:
>>>>>> Starts learning assembly...
>>>>>>
>>>>>> Haha I'll look at the problem
>>>>>>
>>>>>> Chris McKnight
>>>>>> Sent from my iPhone
>>>>>>
>>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>>> wrote:
>>>>>>
>>>>>> > Okay -- I got a challenge for y'all:
>>>>>> >
>>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>>>>>> >
>>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>>> fastest.
>>>>>> >
>>>>>>
>>>>>> >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>>>>>>
>>>>>> >
>>>>>> > So -- who can beat me?
>>>>>> >
>>>>>> > --
>>>>>> > Isaac Traxler -- personal e-mail
>>>>>> > _______________________________________________
>>>>>> > Icpc-practice mailing list
>>>>>> > Icpc-
>>>>>> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>>>>> _______________________________________________
>>>>>> Icpc-practice mailing list
>>>>>> Icpc-
>>>>>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>
>>
>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)

  #9  
04-08-2012 08:28 PM
Icpc-practice member admin is online now
User
 

Okay -- I got a challenge for y'all:

I have solved the problem 10823: Of Circles and Squares


http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764

In fact, if you look at the statistics list I am the 5th fastest.

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=

So -- who can beat me?

--
Isaac Traxler -- personal e-mail
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
Starts learning assembly...

Haha I'll look at the problem

Chris McKnight
Sent from my iPhone

On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:

> Okay -- I got a challenge for y'all:
>
> I have solved the problem 10823: Of Circles and Squares
>
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>
> In fact, if you look at the statistics list I am the 5th fastest.
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
> So -- who can beat me?
>
> --
> Isaac Traxler -- personal e-mail
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
rank 6th code =>
https://github.com/mgavin/acm-code/blob/master/ofcands.cpp

what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O
? argh!

---------- Forwarded message ----------
From: Matthew Gavin <>
Date: Fri, Aug 3, 2012 at 2:59 PM
Subject: Re: [Icpc-practice] challenge
To: Chris McKnight <>


rank 6th code =>
https://github.com/mgavin/acm-code/blob/master/ofcands.cpp

what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O
? argh!


On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>wrote:

> Starts learning assembly...
>
> Haha I'll look at the problem
>
> Chris McKnight
> Sent from my iPhone
>
> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:
>
> > Okay -- I got a challenge for y'all:
> >
> > I have solved the problem 10823: Of Circles and Squares
> >
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> > In fact, if you look at the statistics list I am the 5th fastest.
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
> >
> > So -- who can beat me?
> >
> > --
> > Isaac Traxler -- personal e-mail
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>


One small thing you ccan do is to avoid recomputing radius squared and teh
x+ length, y+ length. I added extra fields in my strcut and calculated all
of those values as I read it in sot hat when more than 1 query occurred,
it would not have to recompute.

I di dnot see you on the list, so I submitted your code and got a time of
.016

1) .010
2-5) .012
6) .014
7-13) .016

So it looks like you will show up 14th.

It also looks like the accuracy is to the nearest .002 of a second.

Maybe the suggestion above will buy you an increase -- but maybe not.

I am guessing that converting from c++ to c may buy you .002.

The only othr way I can think of to improve performance (for me also) is
to change the I/O method (scanf is pretty inefficient). I suspect that
.010 of my runtime is in the I/O and .002 is in the computation.

--
Isaac Traxler AIX,Linux Admin
Louisiana State University
High Performance Computing 225-578-1923
LONI AIX Clusters
AIX, Linux Support

On Fri, 3 Aug 2012, Matthew Gavin wrote:

> Date: Fri, 3 Aug 2012 19:59:52 +0000
> From: Matthew Gavin <>
> To: Chris McKnight <>
> Cc: icpc-
> Subject: Re: [Icpc-practice] challenge
>
> rank 6th code =>
> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>
> what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O ? argh!
>
> ---------- Forwarded message ----------
> From: Matthew Gavin <>
> Date: Fri, Aug 3, 2012 at 2:59 PM
> Subject: Re: [Icpc-practice] challenge
> To: Chris McKnight <>
>
>
> rank 6th code =>
> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>
> what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O ? argh!
>
> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <> wrote:
> Starts learning assembly...
>
> Haha I'll look at the problem
>
> Chris McKnight
> Sent from my iPhone
>
> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:
>
> > Okay -- I got a challenge for y'all:
> >
> > I have solved the problem 10823: Of Circles and Squares
> >
> >
> > http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> > In fact, if you look at the statistics list I am the 5th fastest.
> >
> >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
> >
> > So -- who can beat me?
> >
> > --
> > Isaac Traxler -- personal e-mail
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>
>
>
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
hopefully their servers will get updated later. I've submitted like 20
times and it still says my best attempt was 0.036 run time... I'll see
about the precomputations and wonder later about storing the queries in an
array, but yeah, later.

I tried using fgets (which was supposed to cut time from scanf's superb
processing) but then I needed strtok and atoi to grab different values out
of the line. I'm not sure it added overhead, but when I submitted that code
to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
sure what could be cut out of I/O though =\

but yeah, til later.

On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:

> One small thing you ccan do is to avoid recomputing radius squared and teh
> x+ length, y+ length. I added extra fields in my strcut and calculated all
> of those values as I read it in sot hat when more than 1 query occurred, it
> would not have to recompute.
>
> I di dnot see you on the list, so I submitted your code and got a time of
> .016
>
> 1) .010
> 2-5) .012
> 6) .014
> 7-13) .016
>
> So it looks like you will show up 14th.
>
> It also looks like the accuracy is to the nearest .002 of a second.
>
> Maybe the suggestion above will buy you an increase -- but maybe not.
>
> I am guessing that converting from c++ to c may buy you .002.
>
> The only othr way I can think of to improve performance (for me also) is
> to change the I/O method (scanf is pretty inefficient). I suspect that .010
> of my runtime is in the I/O and .002 is in the computation.
>
> --
> Isaac Traxler AIX,Linux Admin
> Louisiana State University
> High Performance Computing 225-578-1923
> LONI AIX Clusters
> AIX, Linux Support
>
> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>
> Date: Fri, 3 Aug 2012 19:59:52 +0000
>> From: Matthew Gavin <>
>> To: Chris McKnight <>
>> Cc: icpc-
>> Subject: Re: [Icpc-practice] challenge
>>
>>
>> rank 6th code =>
>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>
>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>> I/O ? argh!
>>
>> ---------- Forwarded message ----------
>> From: Matthew Gavin <>
>> Date: Fri, Aug 3, 2012 at 2:59 PM
>> Subject: Re: [Icpc-practice] challenge
>> To: Chris McKnight <>
>>
>>
>> rank 6th code =>
>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>
>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>> I/O ? argh!
>>
>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>> wrote:
>> Starts learning assembly...
>>
>> Haha I'll look at the problem
>>
>> Chris McKnight
>> Sent from my iPhone
>>
>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>> wrote:
>>
>> > Okay -- I got a challenge for y'all:
>> >
>> > I have solved the problem 10823: Of Circles and Squares
>> >
>> >
>> > http://uva.onlinejudge.org/**index.php?option=com_**
>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>> >
>> > In fact, if you look at the statistics list I am the 5th fastest.
>> >
>> >http://uva.onlinejudge.org/**index.php?option=com_**
>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>
>> >
>> > So -- who can beat me?
>> >
>> > --
>> > Isaac Traxler -- personal e-mail
>> > ______________________________**_________________
>> > Icpc-practice mailing list
>> > Icpc-
>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>> ______________________________**_________________
>> Icpc-practice mailing list
>> Icpc-
>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>
>>
>>
>>
>>
>>


On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>
> See! I told you ;). 6th.
>
> I wish there were a book on like the lower internals of the system, and
> how to create extremely efficient code and what pitfalls to look for when
> using different methods in C/C++...
> but maybe that information just comes with the teachings of theory in
> higher level CS courses? :\
>
>
> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>
>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>> hopefully their servers will get updated later. I've submitted like 20
>> times and it still says my best attempt was 0.036 run time... I'll see
>> about the precomputations and wonder later about storing the queries in an
>> array, but yeah, later.
>>
>> I tried using fgets (which was supposed to cut time from scanf's superb
>> processing) but then I needed strtok and atoi to grab different values out
>> of the line. I'm not sure it added overhead, but when I submitted that code
>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>> sure what could be cut out of I/O though =\
>>
>> but yeah, til later.
>>
>>
>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>
>>> One small thing you ccan do is to avoid recomputing radius squared and
>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>> all of those values as I read it in sot hat when more than 1 query
>>> occurred, it would not have to recompute.
>>>
>>> I di dnot see you on the list, so I submitted your code and got a time
>>> of .016
>>>
>>> 1) .010
>>> 2-5) .012
>>> 6) .014
>>> 7-13) .016
>>>
>>> So it looks like you will show up 14th.
>>>
>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>
>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>
>>> I am guessing that converting from c++ to c may buy you .002.
>>>
>>> The only othr way I can think of to improve performance (for me also) is
>>> to change the I/O method (scanf is pretty inefficient). I suspect that .010
>>> of my runtime is in the I/O and .002 is in the computation.
>>>
>>> --
>>> Isaac Traxler AIX,Linux Admin
>>> Louisiana State University
>>> High Performance Computing 225-578-1923
>>> LONI AIX Clusters
>>> AIX, Linux Support
>>>
>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>
>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>> From: Matthew Gavin <>
>>>> To: Chris McKnight <>
>>>> Cc: icpc-
>>>> Subject: Re: [Icpc-practice] challenge
>>>>
>>>>
>>>> rank 6th code =>
>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>
>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>> I/O ? argh!
>>>>
>>>> ---------- Forwarded message ----------
>>>> From: Matthew Gavin <>
>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>> Subject: Re: [Icpc-practice] challenge
>>>> To: Chris McKnight <>
>>>>
>>>>
>>>> rank 6th code =>
>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>
>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>> I/O ? argh!
>>>>
>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>> wrote:
>>>> Starts learning assembly...
>>>>
>>>> Haha I'll look at the problem
>>>>
>>>> Chris McKnight
>>>> Sent from my iPhone
>>>>
>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>> wrote:
>>>>
>>>> > Okay -- I got a challenge for y'all:
>>>> >
>>>> > I have solved the problem 10823: Of Circles and Squares
>>>> >
>>>> >
>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>> >
>>>> > In fact, if you look at the statistics list I am the 5th
>>>> fastest.
>>>> >
>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>
>>>> >
>>>> > So -- who can beat me?
>>>> >
>>>> > --
>>>> > Isaac Traxler -- personal e-mail
>>>> > ______________________________**_________________
>>>> > Icpc-practice mailing list
>>>> > Icpc-
>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>> ______________________________**_________________
>>>> Icpc-practice mailing list
>>>> Icpc-
>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>
>


https://raw.github.com/mgavin/acm-code/master/ofcands.c

bit shifts instead of *2, goto's..., compiling in c, no point struct...,
pre-computing px+length and py+length instead of doing it twice.. :\

still 0.12

I don't know anymore...

On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>
>>
>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>
>> See! I told you ;). 6th.
>>
>> I wish there were a book on like the lower internals of the system, and
>> how to create extremely efficient code and what pitfalls to look for when
>> using different methods in C/C++...
>> but maybe that information just comes with the teachings of theory in
>> higher level CS courses? :\
>>
>>
>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>>
>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>>> hopefully their servers will get updated later. I've submitted like 20
>>> times and it still says my best attempt was 0.036 run time... I'll see
>>> about the precomputations and wonder later about storing the queries in an
>>> array, but yeah, later.
>>>
>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>> processing) but then I needed strtok and atoi to grab different values out
>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>> sure what could be cut out of I/O though =\
>>>
>>> but yeah, til later.
>>>
>>>
>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>>
>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>> all of those values as I read it in sot hat when more than 1 query
>>>> occurred, it would not have to recompute.
>>>>
>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>> of .016
>>>>
>>>> 1) .010
>>>> 2-5) .012
>>>> 6) .014
>>>> 7-13) .016
>>>>
>>>> So it looks like you will show up 14th.
>>>>
>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>
>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>
>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>
>>>> The only othr way I can think of to improve performance (for me also)
>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>
>>>> --
>>>> Isaac Traxler AIX,Linux Admin
>>>> Louisiana State University
>>>> High Performance Computing 225-578-1923
>>>> LONI AIX Clusters
>>>> AIX, Linux Support
>>>>
>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>
>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>> From: Matthew Gavin <>
>>>>> To: Chris McKnight <>
>>>>> Cc: icpc-
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> ---------- Forwarded message ----------
>>>>> From: Matthew Gavin <>
>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>> To: Chris McKnight <>
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>>> wrote:
>>>>> Starts learning assembly...
>>>>>
>>>>> Haha I'll look at the problem
>>>>>
>>>>> Chris McKnight
>>>>> Sent from my iPhone
>>>>>
>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>> wrote:
>>>>>
>>>>> > Okay -- I got a challenge for y'all:
>>>>> >
>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>> >
>>>>> >
>>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>>> >
>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>> fastest.
>>>>> >
>>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>>
>>>>> >
>>>>> > So -- who can beat me?
>>>>> >
>>>>> > --
>>>>> > Isaac Traxler -- personal e-mail
>>>>> > ______________________________**_________________
>>>>> > Icpc-practice mailing list
>>>>> > Icpc-
>>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>> ______________________________**_________________
>>>>> Icpc-practice mailing list
>>>>> Icpc-
>>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>
>


That seems to suggest what Isaac said the other day: The majority of
the time is spent handling input/output rather than in computation.

On Sat, Aug 4, 2012 at 1:52 PM, Matthew Gavin <> wrote:
> https://raw.github.com/mgavin/acm-code/master/ofcands.c
>
> bit shifts instead of *2, goto's..., compiling in c, no point struct...,
> pre-computing px+length and py+length instead of doing it twice.. :\
>
> still 0.12
>
> I don't know anymore...
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>
> wrote:
>>
>>
>>
>> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>
>> wrote:
>>>
>>>
>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>>
>>> See! I told you ;). 6th.
>>>
>>> I wish there were a book on like the lower internals of the system, and
>>> how to create extremely efficient code and what pitfalls to look for when
>>> using different methods in C/C++...
>>> but maybe that information just comes with the teachings of theory in
>>> higher level CS courses? :\
>>>
>>>
>>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>
>>> wrote:
>>>>
>>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>>>> hopefully their servers will get updated later. I've submitted like 20 times
>>>> and it still says my best attempt was 0.036 run time... I'll see about the
>>>> precomputations and wonder later about storing the queries in an array, but
>>>> yeah, later.
>>>>
>>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>>> processing) but then I needed strtok and atoi to grab different values out
>>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>>> sure what could be cut out of I/O though =\
>>>>
>>>> but yeah, til later.
>>>>
>>>>
>>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>>>>
>>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>>> all of those values as I read it in sot hat when more than 1 query occurred,
>>>>> it would not have to recompute.
>>>>>
>>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>>> of .016
>>>>>
>>>>> 1) .010
>>>>> 2-5) .012
>>>>> 6) .014
>>>>> 7-13) .016
>>>>>
>>>>> So it looks like you will show up 14th.
>>>>>
>>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>>
>>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>>
>>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>>
>>>>> The only othr way I can think of to improve performance (for me also)
>>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>>
>>>>> --
>>>>> Isaac Traxler AIX,Linux Admin
>>>>> Louisiana State University
>>>>> High Performance Computing 225-578-1923
>>>>> LONI AIX Clusters
>>>>> AIX, Linux Support
>>>>>
>>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>>
>>>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>>> From: Matthew Gavin <>
>>>>>> To: Chris McKnight <>
>>>>>> Cc: icpc-
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>>> I/O ? argh!
>>>>>>
>>>>>> ---------- Forwarded message ----------
>>>>>> From: Matthew Gavin <>
>>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>> To: Chris McKnight <>
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>>> I/O ? argh!
>>>>>>
>>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight
>>>>>> <> wrote:
>>>>>> Starts learning assembly...
>>>>>>
>>>>>> Haha I'll look at the problem
>>>>>>
>>>>>> Chris McKnight
>>>>>> Sent from my iPhone
>>>>>>
>>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>>> wrote:
>>>>>>
>>>>>> > Okay -- I got a challenge for y'all:
>>>>>> >
>>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>>>>>> >
>>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>>> fastest.
>>>>>> >
>>>>>>
>>>>>> >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>>>>>>
>>>>>> >
>>>>>> > So -- who can beat me?
>>>>>> >
>>>>>> > --
>>>>>> > Isaac Traxler -- personal e-mail
>>>>>> > _______________________________________________
>>>>>> > Icpc-practice mailing list
>>>>>> > Icpc-
>>>>>> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>>>>> _______________________________________________
>>>>>> Icpc-practice mailing list
>>>>>> Icpc-
>>>>>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>
>>
>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-172-performance-engineering-of-software-systems-fall-2010/

On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>
>>
>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>
>> See! I told you ;). 6th.
>>
>> I wish there were a book on like the lower internals of the system, and
>> how to create extremely efficient code and what pitfalls to look for when
>> using different methods in C/C++...
>> but maybe that information just comes with the teachings of theory in
>> higher level CS courses? :\
>>
>>
>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>>
>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>>> hopefully their servers will get updated later. I've submitted like 20
>>> times and it still says my best attempt was 0.036 run time... I'll see
>>> about the precomputations and wonder later about storing the queries in an
>>> array, but yeah, later.
>>>
>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>> processing) but then I needed strtok and atoi to grab different values out
>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>> sure what could be cut out of I/O though =\
>>>
>>> but yeah, til later.
>>>
>>>
>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>>
>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>> all of those values as I read it in sot hat when more than 1 query
>>>> occurred, it would not have to recompute.
>>>>
>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>> of .016
>>>>
>>>> 1) .010
>>>> 2-5) .012
>>>> 6) .014
>>>> 7-13) .016
>>>>
>>>> So it looks like you will show up 14th.
>>>>
>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>
>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>
>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>
>>>> The only othr way I can think of to improve performance (for me also)
>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>
>>>> --
>>>> Isaac Traxler AIX,Linux Admin
>>>> Louisiana State University
>>>> High Performance Computing 225-578-1923
>>>> LONI AIX Clusters
>>>> AIX, Linux Support
>>>>
>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>
>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>> From: Matthew Gavin <>
>>>>> To: Chris McKnight <>
>>>>> Cc: icpc-
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> ---------- Forwarded message ----------
>>>>> From: Matthew Gavin <>
>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>> To: Chris McKnight <>
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>>> wrote:
>>>>> Starts learning assembly...
>>>>>
>>>>> Haha I'll look at the problem
>>>>>
>>>>> Chris McKnight
>>>>> Sent from my iPhone
>>>>>
>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>> wrote:
>>>>>
>>>>> > Okay -- I got a challenge for y'all:
>>>>> >
>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>> >
>>>>> >
>>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>>> >
>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>> fastest.
>>>>> >
>>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>>
>>>>> >
>>>>> > So -- who can beat me?
>>>>> >
>>>>> > --
>>>>> > Isaac Traxler -- personal e-mail
>>>>> > ______________________________**_________________
>>>>> > Icpc-practice mailing list
>>>>> > Icpc-
>>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>> ______________________________**_________________
>>>>> Icpc-practice mailing list
>>>>> Icpc-
>>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>



  #10  
05-08-2012 02:09 PM
Icpc-practice member admin is online now
User
 

Okay -- I got a challenge for y'all:

I have solved the problem 10823: Of Circles and Squares


http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764

In fact, if you look at the statistics list I am the 5th fastest.

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=

So -- who can beat me?

--
Isaac Traxler -- personal e-mail
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
Starts learning assembly...

Haha I'll look at the problem

Chris McKnight
Sent from my iPhone

On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:

> Okay -- I got a challenge for y'all:
>
> I have solved the problem 10823: Of Circles and Squares
>
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>
> In fact, if you look at the statistics list I am the 5th fastest.
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
> So -- who can beat me?
>
> --
> Isaac Traxler -- personal e-mail
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
rank 6th code =>
https://github.com/mgavin/acm-code/blob/master/ofcands.cpp

what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O
? argh!

---------- Forwarded message ----------
From: Matthew Gavin <>
Date: Fri, Aug 3, 2012 at 2:59 PM
Subject: Re: [Icpc-practice] challenge
To: Chris McKnight <>


rank 6th code =>
https://github.com/mgavin/acm-code/blob/master/ofcands.cpp

what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O
? argh!


On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>wrote:

> Starts learning assembly...
>
> Haha I'll look at the problem
>
> Chris McKnight
> Sent from my iPhone
>
> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:
>
> > Okay -- I got a challenge for y'all:
> >
> > I have solved the problem 10823: Of Circles and Squares
> >
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> > In fact, if you look at the statistics list I am the 5th fastest.
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
> >
> > So -- who can beat me?
> >
> > --
> > Isaac Traxler -- personal e-mail
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>


One small thing you ccan do is to avoid recomputing radius squared and teh
x+ length, y+ length. I added extra fields in my strcut and calculated all
of those values as I read it in sot hat when more than 1 query occurred,
it would not have to recompute.

I di dnot see you on the list, so I submitted your code and got a time of
.016

1) .010
2-5) .012
6) .014
7-13) .016

So it looks like you will show up 14th.

It also looks like the accuracy is to the nearest .002 of a second.

Maybe the suggestion above will buy you an increase -- but maybe not.

I am guessing that converting from c++ to c may buy you .002.

The only othr way I can think of to improve performance (for me also) is
to change the I/O method (scanf is pretty inefficient). I suspect that
.010 of my runtime is in the I/O and .002 is in the computation.

--
Isaac Traxler AIX,Linux Admin
Louisiana State University
High Performance Computing 225-578-1923
LONI AIX Clusters
AIX, Linux Support

On Fri, 3 Aug 2012, Matthew Gavin wrote:

> Date: Fri, 3 Aug 2012 19:59:52 +0000
> From: Matthew Gavin <>
> To: Chris McKnight <>
> Cc: icpc-
> Subject: Re: [Icpc-practice] challenge
>
> rank 6th code =>
> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>
> what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O ? argh!
>
> ---------- Forwarded message ----------
> From: Matthew Gavin <>
> Date: Fri, Aug 3, 2012 at 2:59 PM
> Subject: Re: [Icpc-practice] challenge
> To: Chris McKnight <>
>
>
> rank 6th code =>
> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>
> what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O ? argh!
>
> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <> wrote:
> Starts learning assembly...
>
> Haha I'll look at the problem
>
> Chris McKnight
> Sent from my iPhone
>
> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:
>
> > Okay -- I got a challenge for y'all:
> >
> > I have solved the problem 10823: Of Circles and Squares
> >
> >
> > http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> > In fact, if you look at the statistics list I am the 5th fastest.
> >
> >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
> >
> > So -- who can beat me?
> >
> > --
> > Isaac Traxler -- personal e-mail
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>
>
>
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
hopefully their servers will get updated later. I've submitted like 20
times and it still says my best attempt was 0.036 run time... I'll see
about the precomputations and wonder later about storing the queries in an
array, but yeah, later.

I tried using fgets (which was supposed to cut time from scanf's superb
processing) but then I needed strtok and atoi to grab different values out
of the line. I'm not sure it added overhead, but when I submitted that code
to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
sure what could be cut out of I/O though =\

but yeah, til later.

On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:

> One small thing you ccan do is to avoid recomputing radius squared and teh
> x+ length, y+ length. I added extra fields in my strcut and calculated all
> of those values as I read it in sot hat when more than 1 query occurred, it
> would not have to recompute.
>
> I di dnot see you on the list, so I submitted your code and got a time of
> .016
>
> 1) .010
> 2-5) .012
> 6) .014
> 7-13) .016
>
> So it looks like you will show up 14th.
>
> It also looks like the accuracy is to the nearest .002 of a second.
>
> Maybe the suggestion above will buy you an increase -- but maybe not.
>
> I am guessing that converting from c++ to c may buy you .002.
>
> The only othr way I can think of to improve performance (for me also) is
> to change the I/O method (scanf is pretty inefficient). I suspect that .010
> of my runtime is in the I/O and .002 is in the computation.
>
> --
> Isaac Traxler AIX,Linux Admin
> Louisiana State University
> High Performance Computing 225-578-1923
> LONI AIX Clusters
> AIX, Linux Support
>
> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>
> Date: Fri, 3 Aug 2012 19:59:52 +0000
>> From: Matthew Gavin <>
>> To: Chris McKnight <>
>> Cc: icpc-
>> Subject: Re: [Icpc-practice] challenge
>>
>>
>> rank 6th code =>
>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>
>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>> I/O ? argh!
>>
>> ---------- Forwarded message ----------
>> From: Matthew Gavin <>
>> Date: Fri, Aug 3, 2012 at 2:59 PM
>> Subject: Re: [Icpc-practice] challenge
>> To: Chris McKnight <>
>>
>>
>> rank 6th code =>
>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>
>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>> I/O ? argh!
>>
>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>> wrote:
>> Starts learning assembly...
>>
>> Haha I'll look at the problem
>>
>> Chris McKnight
>> Sent from my iPhone
>>
>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>> wrote:
>>
>> > Okay -- I got a challenge for y'all:
>> >
>> > I have solved the problem 10823: Of Circles and Squares
>> >
>> >
>> > http://uva.onlinejudge.org/**index.php?option=com_**
>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>> >
>> > In fact, if you look at the statistics list I am the 5th fastest.
>> >
>> >http://uva.onlinejudge.org/**index.php?option=com_**
>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>
>> >
>> > So -- who can beat me?
>> >
>> > --
>> > Isaac Traxler -- personal e-mail
>> > ______________________________**_________________
>> > Icpc-practice mailing list
>> > Icpc-
>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>> ______________________________**_________________
>> Icpc-practice mailing list
>> Icpc-
>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>
>>
>>
>>
>>
>>


On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>
> See! I told you ;). 6th.
>
> I wish there were a book on like the lower internals of the system, and
> how to create extremely efficient code and what pitfalls to look for when
> using different methods in C/C++...
> but maybe that information just comes with the teachings of theory in
> higher level CS courses? :\
>
>
> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>
>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>> hopefully their servers will get updated later. I've submitted like 20
>> times and it still says my best attempt was 0.036 run time... I'll see
>> about the precomputations and wonder later about storing the queries in an
>> array, but yeah, later.
>>
>> I tried using fgets (which was supposed to cut time from scanf's superb
>> processing) but then I needed strtok and atoi to grab different values out
>> of the line. I'm not sure it added overhead, but when I submitted that code
>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>> sure what could be cut out of I/O though =\
>>
>> but yeah, til later.
>>
>>
>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>
>>> One small thing you ccan do is to avoid recomputing radius squared and
>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>> all of those values as I read it in sot hat when more than 1 query
>>> occurred, it would not have to recompute.
>>>
>>> I di dnot see you on the list, so I submitted your code and got a time
>>> of .016
>>>
>>> 1) .010
>>> 2-5) .012
>>> 6) .014
>>> 7-13) .016
>>>
>>> So it looks like you will show up 14th.
>>>
>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>
>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>
>>> I am guessing that converting from c++ to c may buy you .002.
>>>
>>> The only othr way I can think of to improve performance (for me also) is
>>> to change the I/O method (scanf is pretty inefficient). I suspect that .010
>>> of my runtime is in the I/O and .002 is in the computation.
>>>
>>> --
>>> Isaac Traxler AIX,Linux Admin
>>> Louisiana State University
>>> High Performance Computing 225-578-1923
>>> LONI AIX Clusters
>>> AIX, Linux Support
>>>
>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>
>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>> From: Matthew Gavin <>
>>>> To: Chris McKnight <>
>>>> Cc: icpc-
>>>> Subject: Re: [Icpc-practice] challenge
>>>>
>>>>
>>>> rank 6th code =>
>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>
>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>> I/O ? argh!
>>>>
>>>> ---------- Forwarded message ----------
>>>> From: Matthew Gavin <>
>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>> Subject: Re: [Icpc-practice] challenge
>>>> To: Chris McKnight <>
>>>>
>>>>
>>>> rank 6th code =>
>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>
>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>> I/O ? argh!
>>>>
>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>> wrote:
>>>> Starts learning assembly...
>>>>
>>>> Haha I'll look at the problem
>>>>
>>>> Chris McKnight
>>>> Sent from my iPhone
>>>>
>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>> wrote:
>>>>
>>>> > Okay -- I got a challenge for y'all:
>>>> >
>>>> > I have solved the problem 10823: Of Circles and Squares
>>>> >
>>>> >
>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>> >
>>>> > In fact, if you look at the statistics list I am the 5th
>>>> fastest.
>>>> >
>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>
>>>> >
>>>> > So -- who can beat me?
>>>> >
>>>> > --
>>>> > Isaac Traxler -- personal e-mail
>>>> > ______________________________**_________________
>>>> > Icpc-practice mailing list
>>>> > Icpc-
>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>> ______________________________**_________________
>>>> Icpc-practice mailing list
>>>> Icpc-
>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>
>


https://raw.github.com/mgavin/acm-code/master/ofcands.c

bit shifts instead of *2, goto's..., compiling in c, no point struct...,
pre-computing px+length and py+length instead of doing it twice.. :\

still 0.12

I don't know anymore...

On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>
>>
>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>
>> See! I told you ;). 6th.
>>
>> I wish there were a book on like the lower internals of the system, and
>> how to create extremely efficient code and what pitfalls to look for when
>> using different methods in C/C++...
>> but maybe that information just comes with the teachings of theory in
>> higher level CS courses? :\
>>
>>
>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>>
>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>>> hopefully their servers will get updated later. I've submitted like 20
>>> times and it still says my best attempt was 0.036 run time... I'll see
>>> about the precomputations and wonder later about storing the queries in an
>>> array, but yeah, later.
>>>
>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>> processing) but then I needed strtok and atoi to grab different values out
>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>> sure what could be cut out of I/O though =\
>>>
>>> but yeah, til later.
>>>
>>>
>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>>
>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>> all of those values as I read it in sot hat when more than 1 query
>>>> occurred, it would not have to recompute.
>>>>
>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>> of .016
>>>>
>>>> 1) .010
>>>> 2-5) .012
>>>> 6) .014
>>>> 7-13) .016
>>>>
>>>> So it looks like you will show up 14th.
>>>>
>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>
>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>
>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>
>>>> The only othr way I can think of to improve performance (for me also)
>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>
>>>> --
>>>> Isaac Traxler AIX,Linux Admin
>>>> Louisiana State University
>>>> High Performance Computing 225-578-1923
>>>> LONI AIX Clusters
>>>> AIX, Linux Support
>>>>
>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>
>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>> From: Matthew Gavin <>
>>>>> To: Chris McKnight <>
>>>>> Cc: icpc-
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> ---------- Forwarded message ----------
>>>>> From: Matthew Gavin <>
>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>> To: Chris McKnight <>
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>>> wrote:
>>>>> Starts learning assembly...
>>>>>
>>>>> Haha I'll look at the problem
>>>>>
>>>>> Chris McKnight
>>>>> Sent from my iPhone
>>>>>
>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>> wrote:
>>>>>
>>>>> > Okay -- I got a challenge for y'all:
>>>>> >
>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>> >
>>>>> >
>>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>>> >
>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>> fastest.
>>>>> >
>>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>>
>>>>> >
>>>>> > So -- who can beat me?
>>>>> >
>>>>> > --
>>>>> > Isaac Traxler -- personal e-mail
>>>>> > ______________________________**_________________
>>>>> > Icpc-practice mailing list
>>>>> > Icpc-
>>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>> ______________________________**_________________
>>>>> Icpc-practice mailing list
>>>>> Icpc-
>>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>
>


That seems to suggest what Isaac said the other day: The majority of
the time is spent handling input/output rather than in computation.

On Sat, Aug 4, 2012 at 1:52 PM, Matthew Gavin <> wrote:
> https://raw.github.com/mgavin/acm-code/master/ofcands.c
>
> bit shifts instead of *2, goto's..., compiling in c, no point struct...,
> pre-computing px+length and py+length instead of doing it twice.. :\
>
> still 0.12
>
> I don't know anymore...
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>
> wrote:
>>
>>
>>
>> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>
>> wrote:
>>>
>>>
>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>>
>>> See! I told you ;). 6th.
>>>
>>> I wish there were a book on like the lower internals of the system, and
>>> how to create extremely efficient code and what pitfalls to look for when
>>> using different methods in C/C++...
>>> but maybe that information just comes with the teachings of theory in
>>> higher level CS courses? :\
>>>
>>>
>>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>
>>> wrote:
>>>>
>>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>>>> hopefully their servers will get updated later. I've submitted like 20 times
>>>> and it still says my best attempt was 0.036 run time... I'll see about the
>>>> precomputations and wonder later about storing the queries in an array, but
>>>> yeah, later.
>>>>
>>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>>> processing) but then I needed strtok and atoi to grab different values out
>>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>>> sure what could be cut out of I/O though =\
>>>>
>>>> but yeah, til later.
>>>>
>>>>
>>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>>>>
>>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>>> all of those values as I read it in sot hat when more than 1 query occurred,
>>>>> it would not have to recompute.
>>>>>
>>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>>> of .016
>>>>>
>>>>> 1) .010
>>>>> 2-5) .012
>>>>> 6) .014
>>>>> 7-13) .016
>>>>>
>>>>> So it looks like you will show up 14th.
>>>>>
>>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>>
>>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>>
>>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>>
>>>>> The only othr way I can think of to improve performance (for me also)
>>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>>
>>>>> --
>>>>> Isaac Traxler AIX,Linux Admin
>>>>> Louisiana State University
>>>>> High Performance Computing 225-578-1923
>>>>> LONI AIX Clusters
>>>>> AIX, Linux Support
>>>>>
>>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>>
>>>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>>> From: Matthew Gavin <>
>>>>>> To: Chris McKnight <>
>>>>>> Cc: icpc-
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>>> I/O ? argh!
>>>>>>
>>>>>> ---------- Forwarded message ----------
>>>>>> From: Matthew Gavin <>
>>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>> To: Chris McKnight <>
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>>> I/O ? argh!
>>>>>>
>>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight
>>>>>> <> wrote:
>>>>>> Starts learning assembly...
>>>>>>
>>>>>> Haha I'll look at the problem
>>>>>>
>>>>>> Chris McKnight
>>>>>> Sent from my iPhone
>>>>>>
>>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>>> wrote:
>>>>>>
>>>>>> > Okay -- I got a challenge for y'all:
>>>>>> >
>>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>>>>>> >
>>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>>> fastest.
>>>>>> >
>>>>>>
>>>>>> >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>>>>>>
>>>>>> >
>>>>>> > So -- who can beat me?
>>>>>> >
>>>>>> > --
>>>>>> > Isaac Traxler -- personal e-mail
>>>>>> > _______________________________________________
>>>>>> > Icpc-practice mailing list
>>>>>> > Icpc-
>>>>>> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>>>>> _______________________________________________
>>>>>> Icpc-practice mailing list
>>>>>> Icpc-
>>>>>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>
>>
>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-172-performance-engineering-of-software-systems-fall-2010/

On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>
>>
>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>
>> See! I told you ;). 6th.
>>
>> I wish there were a book on like the lower internals of the system, and
>> how to create extremely efficient code and what pitfalls to look for when
>> using different methods in C/C++...
>> but maybe that information just comes with the teachings of theory in
>> higher level CS courses? :\
>>
>>
>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>>
>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>>> hopefully their servers will get updated later. I've submitted like 20
>>> times and it still says my best attempt was 0.036 run time... I'll see
>>> about the precomputations and wonder later about storing the queries in an
>>> array, but yeah, later.
>>>
>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>> processing) but then I needed strtok and atoi to grab different values out
>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>> sure what could be cut out of I/O though =\
>>>
>>> but yeah, til later.
>>>
>>>
>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>>
>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>> all of those values as I read it in sot hat when more than 1 query
>>>> occurred, it would not have to recompute.
>>>>
>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>> of .016
>>>>
>>>> 1) .010
>>>> 2-5) .012
>>>> 6) .014
>>>> 7-13) .016
>>>>
>>>> So it looks like you will show up 14th.
>>>>
>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>
>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>
>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>
>>>> The only othr way I can think of to improve performance (for me also)
>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>
>>>> --
>>>> Isaac Traxler AIX,Linux Admin
>>>> Louisiana State University
>>>> High Performance Computing 225-578-1923
>>>> LONI AIX Clusters
>>>> AIX, Linux Support
>>>>
>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>
>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>> From: Matthew Gavin <>
>>>>> To: Chris McKnight <>
>>>>> Cc: icpc-
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> ---------- Forwarded message ----------
>>>>> From: Matthew Gavin <>
>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>> To: Chris McKnight <>
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>>> wrote:
>>>>> Starts learning assembly...
>>>>>
>>>>> Haha I'll look at the problem
>>>>>
>>>>> Chris McKnight
>>>>> Sent from my iPhone
>>>>>
>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>> wrote:
>>>>>
>>>>> > Okay -- I got a challenge for y'all:
>>>>> >
>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>> >
>>>>> >
>>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>>> >
>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>> fastest.
>>>>> >
>>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>>
>>>>> >
>>>>> > So -- who can beat me?
>>>>> >
>>>>> > --
>>>>> > Isaac Traxler -- personal e-mail
>>>>> > ______________________________**_________________
>>>>> > Icpc-practice mailing list
>>>>> > Icpc-
>>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>> ______________________________**_________________
>>>>> Icpc-practice mailing list
>>>>> Icpc-
>>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>


HAAHAHAHA YAY

Got rank 1, 0.008 run time. I went on IRC and asked for I/O speed up help,
and someone suggested strtol :)

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24<-
proof
https://raw.github.com/mgavin/acm-code/master/ofcands.c <- code

^_^, wooooooh

but of course I couldn't have done it without Isaac's suggestions for
speeding up the processing in the first place ;)

On Sat, Aug 4, 2012 at 2:28 PM, Bruno Beltran <>wrote:

>
> http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-172-performance-engineering-of-software-systems-fall-2010/
>
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>
>>
>>
>> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>>
>>>
>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>>
>>> See! I told you ;). 6th.
>>>
>>> I wish there were a book on like the lower internals of the system, and
>>> how to create extremely efficient code and what pitfalls to look for when
>>> using different methods in C/C++...
>>> but maybe that information just comes with the teachings of theory in
>>> higher level CS courses? :\
>>>
>>>
>>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>>>
>>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it,
>>>> so hopefully their servers will get updated later. I've submitted like 20
>>>> times and it still says my best attempt was 0.036 run time... I'll see
>>>> about the precomputations and wonder later about storing the queries in an
>>>> array, but yeah, later.
>>>>
>>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>>> processing) but then I needed strtok and atoi to grab different values out
>>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>>> sure what could be cut out of I/O though =\
>>>>
>>>> but yeah, til later.
>>>>
>>>>
>>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <>wrote:
>>>>
>>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>>> all of those values as I read it in sot hat when more than 1 query
>>>>> occurred, it would not have to recompute.
>>>>>
>>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>>> of .016
>>>>>
>>>>> 1) .010
>>>>> 2-5) .012
>>>>> 6) .014
>>>>> 7-13) .016
>>>>>
>>>>> So it looks like you will show up 14th.
>>>>>
>>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>>
>>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>>
>>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>>
>>>>> The only othr way I can think of to improve performance (for me also)
>>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>>
>>>>> --
>>>>> Isaac Traxler AIX,Linux Admin
>>>>> Louisiana State University
>>>>> High Performance Computing 225-578-1923
>>>>> LONI AIX Clusters
>>>>> AIX, Linux Support
>>>>>
>>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>>
>>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>>> From: Matthew Gavin <>
>>>>>> To: Chris McKnight <>
>>>>>> Cc: icpc-
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math
>>>>>> precision? I/O ? argh!
>>>>>>
>>>>>> ---------- Forwarded message ----------
>>>>>> From: Matthew Gavin <>
>>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>> To: Chris McKnight <>
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math
>>>>>> precision? I/O ? argh!
>>>>>>
>>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <
>>>>>> > wrote:
>>>>>> Starts learning assembly...
>>>>>>
>>>>>> Haha I'll look at the problem
>>>>>>
>>>>>> Chris McKnight
>>>>>> Sent from my iPhone
>>>>>>
>>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>>> wrote:
>>>>>>
>>>>>> > Okay -- I got a challenge for y'all:
>>>>>> >
>>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>>> >
>>>>>> >
>>>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>>>> >
>>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>>> fastest.
>>>>>> >
>>>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>>>
>>>>>> >
>>>>>> > So -- who can beat me?
>>>>>> >
>>>>>> > --
>>>>>> > Isaac Traxler -- personal e-mail
>>>>>> > ______________________________**_________________
>>>>>> > Icpc-practice mailing list
>>>>>> > Icpc-
>>>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>> ______________________________**_________________
>>>>>> Icpc-practice mailing list
>>>>>> Icpc-
>>>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>
>>
>> _______________________________________________
>> Icpc-practice mailing list
>> Icpc-
>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>
>>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>



  #11  
07-08-2012 10:30 AM
Icpc-practice member admin is online now
User
 

Okay -- I got a challenge for y'all:

I have solved the problem 10823: Of Circles and Squares


http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764

In fact, if you look at the statistics list I am the 5th fastest.

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=

So -- who can beat me?

--
Isaac Traxler -- personal e-mail
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
Starts learning assembly...

Haha I'll look at the problem

Chris McKnight
Sent from my iPhone

On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:

> Okay -- I got a challenge for y'all:
>
> I have solved the problem 10823: Of Circles and Squares
>
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>
> In fact, if you look at the statistics list I am the 5th fastest.
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
> So -- who can beat me?
>
> --
> Isaac Traxler -- personal e-mail
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
rank 6th code =>
https://github.com/mgavin/acm-code/blob/master/ofcands.cpp

what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O
? argh!

---------- Forwarded message ----------
From: Matthew Gavin <>
Date: Fri, Aug 3, 2012 at 2:59 PM
Subject: Re: [Icpc-practice] challenge
To: Chris McKnight <>


rank 6th code =>
https://github.com/mgavin/acm-code/blob/master/ofcands.cpp

what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O
? argh!


On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>wrote:

> Starts learning assembly...
>
> Haha I'll look at the problem
>
> Chris McKnight
> Sent from my iPhone
>
> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:
>
> > Okay -- I got a challenge for y'all:
> >
> > I have solved the problem 10823: Of Circles and Squares
> >
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> > In fact, if you look at the statistics list I am the 5th fastest.
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
> >
> > So -- who can beat me?
> >
> > --
> > Isaac Traxler -- personal e-mail
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>


One small thing you ccan do is to avoid recomputing radius squared and teh
x+ length, y+ length. I added extra fields in my strcut and calculated all
of those values as I read it in sot hat when more than 1 query occurred,
it would not have to recompute.

I di dnot see you on the list, so I submitted your code and got a time of
.016

1) .010
2-5) .012
6) .014
7-13) .016

So it looks like you will show up 14th.

It also looks like the accuracy is to the nearest .002 of a second.

Maybe the suggestion above will buy you an increase -- but maybe not.

I am guessing that converting from c++ to c may buy you .002.

The only othr way I can think of to improve performance (for me also) is
to change the I/O method (scanf is pretty inefficient). I suspect that
.010 of my runtime is in the I/O and .002 is in the computation.

--
Isaac Traxler AIX,Linux Admin
Louisiana State University
High Performance Computing 225-578-1923
LONI AIX Clusters
AIX, Linux Support

On Fri, 3 Aug 2012, Matthew Gavin wrote:

> Date: Fri, 3 Aug 2012 19:59:52 +0000
> From: Matthew Gavin <>
> To: Chris McKnight <>
> Cc: icpc-
> Subject: Re: [Icpc-practice] challenge
>
> rank 6th code =>
> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>
> what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O ? argh!
>
> ---------- Forwarded message ----------
> From: Matthew Gavin <>
> Date: Fri, Aug 3, 2012 at 2:59 PM
> Subject: Re: [Icpc-practice] challenge
> To: Chris McKnight <>
>
>
> rank 6th code =>
> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>
> what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O ? argh!
>
> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <> wrote:
> Starts learning assembly...
>
> Haha I'll look at the problem
>
> Chris McKnight
> Sent from my iPhone
>
> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:
>
> > Okay -- I got a challenge for y'all:
> >
> > I have solved the problem 10823: Of Circles and Squares
> >
> >
> > http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> > In fact, if you look at the statistics list I am the 5th fastest.
> >
> >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
> >
> > So -- who can beat me?
> >
> > --
> > Isaac Traxler -- personal e-mail
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>
>
>
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
hopefully their servers will get updated later. I've submitted like 20
times and it still says my best attempt was 0.036 run time... I'll see
about the precomputations and wonder later about storing the queries in an
array, but yeah, later.

I tried using fgets (which was supposed to cut time from scanf's superb
processing) but then I needed strtok and atoi to grab different values out
of the line. I'm not sure it added overhead, but when I submitted that code
to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
sure what could be cut out of I/O though =\

but yeah, til later.

On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:

> One small thing you ccan do is to avoid recomputing radius squared and teh
> x+ length, y+ length. I added extra fields in my strcut and calculated all
> of those values as I read it in sot hat when more than 1 query occurred, it
> would not have to recompute.
>
> I di dnot see you on the list, so I submitted your code and got a time of
> .016
>
> 1) .010
> 2-5) .012
> 6) .014
> 7-13) .016
>
> So it looks like you will show up 14th.
>
> It also looks like the accuracy is to the nearest .002 of a second.
>
> Maybe the suggestion above will buy you an increase -- but maybe not.
>
> I am guessing that converting from c++ to c may buy you .002.
>
> The only othr way I can think of to improve performance (for me also) is
> to change the I/O method (scanf is pretty inefficient). I suspect that .010
> of my runtime is in the I/O and .002 is in the computation.
>
> --
> Isaac Traxler AIX,Linux Admin
> Louisiana State University
> High Performance Computing 225-578-1923
> LONI AIX Clusters
> AIX, Linux Support
>
> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>
> Date: Fri, 3 Aug 2012 19:59:52 +0000
>> From: Matthew Gavin <>
>> To: Chris McKnight <>
>> Cc: icpc-
>> Subject: Re: [Icpc-practice] challenge
>>
>>
>> rank 6th code =>
>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>
>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>> I/O ? argh!
>>
>> ---------- Forwarded message ----------
>> From: Matthew Gavin <>
>> Date: Fri, Aug 3, 2012 at 2:59 PM
>> Subject: Re: [Icpc-practice] challenge
>> To: Chris McKnight <>
>>
>>
>> rank 6th code =>
>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>
>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>> I/O ? argh!
>>
>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>> wrote:
>> Starts learning assembly...
>>
>> Haha I'll look at the problem
>>
>> Chris McKnight
>> Sent from my iPhone
>>
>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>> wrote:
>>
>> > Okay -- I got a challenge for y'all:
>> >
>> > I have solved the problem 10823: Of Circles and Squares
>> >
>> >
>> > http://uva.onlinejudge.org/**index.php?option=com_**
>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>> >
>> > In fact, if you look at the statistics list I am the 5th fastest.
>> >
>> >http://uva.onlinejudge.org/**index.php?option=com_**
>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>
>> >
>> > So -- who can beat me?
>> >
>> > --
>> > Isaac Traxler -- personal e-mail
>> > ______________________________**_________________
>> > Icpc-practice mailing list
>> > Icpc-
>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>> ______________________________**_________________
>> Icpc-practice mailing list
>> Icpc-
>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>
>>
>>
>>
>>
>>


On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>
> See! I told you ;). 6th.
>
> I wish there were a book on like the lower internals of the system, and
> how to create extremely efficient code and what pitfalls to look for when
> using different methods in C/C++...
> but maybe that information just comes with the teachings of theory in
> higher level CS courses? :\
>
>
> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>
>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>> hopefully their servers will get updated later. I've submitted like 20
>> times and it still says my best attempt was 0.036 run time... I'll see
>> about the precomputations and wonder later about storing the queries in an
>> array, but yeah, later.
>>
>> I tried using fgets (which was supposed to cut time from scanf's superb
>> processing) but then I needed strtok and atoi to grab different values out
>> of the line. I'm not sure it added overhead, but when I submitted that code
>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>> sure what could be cut out of I/O though =\
>>
>> but yeah, til later.
>>
>>
>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>
>>> One small thing you ccan do is to avoid recomputing radius squared and
>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>> all of those values as I read it in sot hat when more than 1 query
>>> occurred, it would not have to recompute.
>>>
>>> I di dnot see you on the list, so I submitted your code and got a time
>>> of .016
>>>
>>> 1) .010
>>> 2-5) .012
>>> 6) .014
>>> 7-13) .016
>>>
>>> So it looks like you will show up 14th.
>>>
>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>
>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>
>>> I am guessing that converting from c++ to c may buy you .002.
>>>
>>> The only othr way I can think of to improve performance (for me also) is
>>> to change the I/O method (scanf is pretty inefficient). I suspect that .010
>>> of my runtime is in the I/O and .002 is in the computation.
>>>
>>> --
>>> Isaac Traxler AIX,Linux Admin
>>> Louisiana State University
>>> High Performance Computing 225-578-1923
>>> LONI AIX Clusters
>>> AIX, Linux Support
>>>
>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>
>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>> From: Matthew Gavin <>
>>>> To: Chris McKnight <>
>>>> Cc: icpc-
>>>> Subject: Re: [Icpc-practice] challenge
>>>>
>>>>
>>>> rank 6th code =>
>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>
>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>> I/O ? argh!
>>>>
>>>> ---------- Forwarded message ----------
>>>> From: Matthew Gavin <>
>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>> Subject: Re: [Icpc-practice] challenge
>>>> To: Chris McKnight <>
>>>>
>>>>
>>>> rank 6th code =>
>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>
>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>> I/O ? argh!
>>>>
>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>> wrote:
>>>> Starts learning assembly...
>>>>
>>>> Haha I'll look at the problem
>>>>
>>>> Chris McKnight
>>>> Sent from my iPhone
>>>>
>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>> wrote:
>>>>
>>>> > Okay -- I got a challenge for y'all:
>>>> >
>>>> > I have solved the problem 10823: Of Circles and Squares
>>>> >
>>>> >
>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>> >
>>>> > In fact, if you look at the statistics list I am the 5th
>>>> fastest.
>>>> >
>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>
>>>> >
>>>> > So -- who can beat me?
>>>> >
>>>> > --
>>>> > Isaac Traxler -- personal e-mail
>>>> > ______________________________**_________________
>>>> > Icpc-practice mailing list
>>>> > Icpc-
>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>> ______________________________**_________________
>>>> Icpc-practice mailing list
>>>> Icpc-
>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>
>


https://raw.github.com/mgavin/acm-code/master/ofcands.c

bit shifts instead of *2, goto's..., compiling in c, no point struct...,
pre-computing px+length and py+length instead of doing it twice.. :\

still 0.12

I don't know anymore...

On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>
>>
>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>
>> See! I told you ;). 6th.
>>
>> I wish there were a book on like the lower internals of the system, and
>> how to create extremely efficient code and what pitfalls to look for when
>> using different methods in C/C++...
>> but maybe that information just comes with the teachings of theory in
>> higher level CS courses? :\
>>
>>
>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>>
>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>>> hopefully their servers will get updated later. I've submitted like 20
>>> times and it still says my best attempt was 0.036 run time... I'll see
>>> about the precomputations and wonder later about storing the queries in an
>>> array, but yeah, later.
>>>
>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>> processing) but then I needed strtok and atoi to grab different values out
>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>> sure what could be cut out of I/O though =\
>>>
>>> but yeah, til later.
>>>
>>>
>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>>
>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>> all of those values as I read it in sot hat when more than 1 query
>>>> occurred, it would not have to recompute.
>>>>
>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>> of .016
>>>>
>>>> 1) .010
>>>> 2-5) .012
>>>> 6) .014
>>>> 7-13) .016
>>>>
>>>> So it looks like you will show up 14th.
>>>>
>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>
>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>
>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>
>>>> The only othr way I can think of to improve performance (for me also)
>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>
>>>> --
>>>> Isaac Traxler AIX,Linux Admin
>>>> Louisiana State University
>>>> High Performance Computing 225-578-1923
>>>> LONI AIX Clusters
>>>> AIX, Linux Support
>>>>
>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>
>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>> From: Matthew Gavin <>
>>>>> To: Chris McKnight <>
>>>>> Cc: icpc-
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> ---------- Forwarded message ----------
>>>>> From: Matthew Gavin <>
>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>> To: Chris McKnight <>
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>>> wrote:
>>>>> Starts learning assembly...
>>>>>
>>>>> Haha I'll look at the problem
>>>>>
>>>>> Chris McKnight
>>>>> Sent from my iPhone
>>>>>
>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>> wrote:
>>>>>
>>>>> > Okay -- I got a challenge for y'all:
>>>>> >
>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>> >
>>>>> >
>>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>>> >
>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>> fastest.
>>>>> >
>>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>>
>>>>> >
>>>>> > So -- who can beat me?
>>>>> >
>>>>> > --
>>>>> > Isaac Traxler -- personal e-mail
>>>>> > ______________________________**_________________
>>>>> > Icpc-practice mailing list
>>>>> > Icpc-
>>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>> ______________________________**_________________
>>>>> Icpc-practice mailing list
>>>>> Icpc-
>>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>
>


That seems to suggest what Isaac said the other day: The majority of
the time is spent handling input/output rather than in computation.

On Sat, Aug 4, 2012 at 1:52 PM, Matthew Gavin <> wrote:
> https://raw.github.com/mgavin/acm-code/master/ofcands.c
>
> bit shifts instead of *2, goto's..., compiling in c, no point struct...,
> pre-computing px+length and py+length instead of doing it twice.. :\
>
> still 0.12
>
> I don't know anymore...
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>
> wrote:
>>
>>
>>
>> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>
>> wrote:
>>>
>>>
>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>>
>>> See! I told you ;). 6th.
>>>
>>> I wish there were a book on like the lower internals of the system, and
>>> how to create extremely efficient code and what pitfalls to look for when
>>> using different methods in C/C++...
>>> but maybe that information just comes with the teachings of theory in
>>> higher level CS courses? :\
>>>
>>>
>>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>
>>> wrote:
>>>>
>>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>>>> hopefully their servers will get updated later. I've submitted like 20 times
>>>> and it still says my best attempt was 0.036 run time... I'll see about the
>>>> precomputations and wonder later about storing the queries in an array, but
>>>> yeah, later.
>>>>
>>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>>> processing) but then I needed strtok and atoi to grab different values out
>>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>>> sure what could be cut out of I/O though =\
>>>>
>>>> but yeah, til later.
>>>>
>>>>
>>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>>>>
>>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>>> all of those values as I read it in sot hat when more than 1 query occurred,
>>>>> it would not have to recompute.
>>>>>
>>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>>> of .016
>>>>>
>>>>> 1) .010
>>>>> 2-5) .012
>>>>> 6) .014
>>>>> 7-13) .016
>>>>>
>>>>> So it looks like you will show up 14th.
>>>>>
>>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>>
>>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>>
>>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>>
>>>>> The only othr way I can think of to improve performance (for me also)
>>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>>
>>>>> --
>>>>> Isaac Traxler AIX,Linux Admin
>>>>> Louisiana State University
>>>>> High Performance Computing 225-578-1923
>>>>> LONI AIX Clusters
>>>>> AIX, Linux Support
>>>>>
>>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>>
>>>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>>> From: Matthew Gavin <>
>>>>>> To: Chris McKnight <>
>>>>>> Cc: icpc-
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>>> I/O ? argh!
>>>>>>
>>>>>> ---------- Forwarded message ----------
>>>>>> From: Matthew Gavin <>
>>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>> To: Chris McKnight <>
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>>> I/O ? argh!
>>>>>>
>>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight
>>>>>> <> wrote:
>>>>>> Starts learning assembly...
>>>>>>
>>>>>> Haha I'll look at the problem
>>>>>>
>>>>>> Chris McKnight
>>>>>> Sent from my iPhone
>>>>>>
>>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>>> wrote:
>>>>>>
>>>>>> > Okay -- I got a challenge for y'all:
>>>>>> >
>>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>>>>>> >
>>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>>> fastest.
>>>>>> >
>>>>>>
>>>>>> >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>>>>>>
>>>>>> >
>>>>>> > So -- who can beat me?
>>>>>> >
>>>>>> > --
>>>>>> > Isaac Traxler -- personal e-mail
>>>>>> > _______________________________________________
>>>>>> > Icpc-practice mailing list
>>>>>> > Icpc-
>>>>>> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>>>>> _______________________________________________
>>>>>> Icpc-practice mailing list
>>>>>> Icpc-
>>>>>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>
>>
>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-172-performance-engineering-of-software-systems-fall-2010/

On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>
>>
>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>
>> See! I told you ;). 6th.
>>
>> I wish there were a book on like the lower internals of the system, and
>> how to create extremely efficient code and what pitfalls to look for when
>> using different methods in C/C++...
>> but maybe that information just comes with the teachings of theory in
>> higher level CS courses? :\
>>
>>
>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>>
>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>>> hopefully their servers will get updated later. I've submitted like 20
>>> times and it still says my best attempt was 0.036 run time... I'll see
>>> about the precomputations and wonder later about storing the queries in an
>>> array, but yeah, later.
>>>
>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>> processing) but then I needed strtok and atoi to grab different values out
>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>> sure what could be cut out of I/O though =\
>>>
>>> but yeah, til later.
>>>
>>>
>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>>
>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>> all of those values as I read it in sot hat when more than 1 query
>>>> occurred, it would not have to recompute.
>>>>
>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>> of .016
>>>>
>>>> 1) .010
>>>> 2-5) .012
>>>> 6) .014
>>>> 7-13) .016
>>>>
>>>> So it looks like you will show up 14th.
>>>>
>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>
>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>
>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>
>>>> The only othr way I can think of to improve performance (for me also)
>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>
>>>> --
>>>> Isaac Traxler AIX,Linux Admin
>>>> Louisiana State University
>>>> High Performance Computing 225-578-1923
>>>> LONI AIX Clusters
>>>> AIX, Linux Support
>>>>
>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>
>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>> From: Matthew Gavin <>
>>>>> To: Chris McKnight <>
>>>>> Cc: icpc-
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> ---------- Forwarded message ----------
>>>>> From: Matthew Gavin <>
>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>> To: Chris McKnight <>
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>>> wrote:
>>>>> Starts learning assembly...
>>>>>
>>>>> Haha I'll look at the problem
>>>>>
>>>>> Chris McKnight
>>>>> Sent from my iPhone
>>>>>
>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>> wrote:
>>>>>
>>>>> > Okay -- I got a challenge for y'all:
>>>>> >
>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>> >
>>>>> >
>>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>>> >
>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>> fastest.
>>>>> >
>>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>>
>>>>> >
>>>>> > So -- who can beat me?
>>>>> >
>>>>> > --
>>>>> > Isaac Traxler -- personal e-mail
>>>>> > ______________________________**_________________
>>>>> > Icpc-practice mailing list
>>>>> > Icpc-
>>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>> ______________________________**_________________
>>>>> Icpc-practice mailing list
>>>>> Icpc-
>>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>


HAAHAHAHA YAY

Got rank 1, 0.008 run time. I went on IRC and asked for I/O speed up help,
and someone suggested strtol :)

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24<-
proof
https://raw.github.com/mgavin/acm-code/master/ofcands.c <- code

^_^, wooooooh

but of course I couldn't have done it without Isaac's suggestions for
speeding up the processing in the first place ;)

On Sat, Aug 4, 2012 at 2:28 PM, Bruno Beltran <>wrote:

>
> http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-172-performance-engineering-of-software-systems-fall-2010/
>
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>
>>
>>
>> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>>
>>>
>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>>
>>> See! I told you ;). 6th.
>>>
>>> I wish there were a book on like the lower internals of the system, and
>>> how to create extremely efficient code and what pitfalls to look for when
>>> using different methods in C/C++...
>>> but maybe that information just comes with the teachings of theory in
>>> higher level CS courses? :\
>>>
>>>
>>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>>>
>>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it,
>>>> so hopefully their servers will get updated later. I've submitted like 20
>>>> times and it still says my best attempt was 0.036 run time... I'll see
>>>> about the precomputations and wonder later about storing the queries in an
>>>> array, but yeah, later.
>>>>
>>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>>> processing) but then I needed strtok and atoi to grab different values out
>>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>>> sure what could be cut out of I/O though =\
>>>>
>>>> but yeah, til later.
>>>>
>>>>
>>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <>wrote:
>>>>
>>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>>> all of those values as I read it in sot hat when more than 1 query
>>>>> occurred, it would not have to recompute.
>>>>>
>>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>>> of .016
>>>>>
>>>>> 1) .010
>>>>> 2-5) .012
>>>>> 6) .014
>>>>> 7-13) .016
>>>>>
>>>>> So it looks like you will show up 14th.
>>>>>
>>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>>
>>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>>
>>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>>
>>>>> The only othr way I can think of to improve performance (for me also)
>>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>>
>>>>> --
>>>>> Isaac Traxler AIX,Linux Admin
>>>>> Louisiana State University
>>>>> High Performance Computing 225-578-1923
>>>>> LONI AIX Clusters
>>>>> AIX, Linux Support
>>>>>
>>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>>
>>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>>> From: Matthew Gavin <>
>>>>>> To: Chris McKnight <>
>>>>>> Cc: icpc-
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math
>>>>>> precision? I/O ? argh!
>>>>>>
>>>>>> ---------- Forwarded message ----------
>>>>>> From: Matthew Gavin <>
>>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>> To: Chris McKnight <>
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math
>>>>>> precision? I/O ? argh!
>>>>>>
>>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <
>>>>>> > wrote:
>>>>>> Starts learning assembly...
>>>>>>
>>>>>> Haha I'll look at the problem
>>>>>>
>>>>>> Chris McKnight
>>>>>> Sent from my iPhone
>>>>>>
>>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>>> wrote:
>>>>>>
>>>>>> > Okay -- I got a challenge for y'all:
>>>>>> >
>>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>>> >
>>>>>> >
>>>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>>>> >
>>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>>> fastest.
>>>>>> >
>>>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>>>
>>>>>> >
>>>>>> > So -- who can beat me?
>>>>>> >
>>>>>> > --
>>>>>> > Isaac Traxler -- personal e-mail
>>>>>> > ______________________________**_________________
>>>>>> > Icpc-practice mailing list
>>>>>> > Icpc-
>>>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>> ______________________________**_________________
>>>>>> Icpc-practice mailing list
>>>>>> Icpc-
>>>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>
>>
>> _______________________________________________
>> Icpc-practice mailing list
>> Icpc-
>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>
>>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>


X

Isaac Traxler <> wrote:

>Okay -- I got a challenge for y'all:
>
>I have solved the problem 10823: Of Circles and Squares
>
>
>http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>
>In fact, if you look at the statistics list I am the 5th fastest.
>
>http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
>So -- who can beat me?
>
>--
>Isaac Traxler -- personal e-mail
>_______________________________________________
>Icpc-practice mailing list
>Icpc-
>http://isaac.lsu.edu/mailman/listinfo/icpc-practice
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)

  #12  
10-08-2012 05:56 PM
Icpc-practice member admin is online now
User
 

Okay -- I got a challenge for y'all:

I have solved the problem 10823: Of Circles and Squares


http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764

In fact, if you look at the statistics list I am the 5th fastest.

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=

So -- who can beat me?

--
Isaac Traxler -- personal e-mail
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
Starts learning assembly...

Haha I'll look at the problem

Chris McKnight
Sent from my iPhone

On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:

> Okay -- I got a challenge for y'all:
>
> I have solved the problem 10823: Of Circles and Squares
>
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>
> In fact, if you look at the statistics list I am the 5th fastest.
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
> So -- who can beat me?
>
> --
> Isaac Traxler -- personal e-mail
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
rank 6th code =>
https://github.com/mgavin/acm-code/blob/master/ofcands.cpp

what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O
? argh!

---------- Forwarded message ----------
From: Matthew Gavin <>
Date: Fri, Aug 3, 2012 at 2:59 PM
Subject: Re: [Icpc-practice] challenge
To: Chris McKnight <>


rank 6th code =>
https://github.com/mgavin/acm-code/blob/master/ofcands.cpp

what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O
? argh!


On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>wrote:

> Starts learning assembly...
>
> Haha I'll look at the problem
>
> Chris McKnight
> Sent from my iPhone
>
> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:
>
> > Okay -- I got a challenge for y'all:
> >
> > I have solved the problem 10823: Of Circles and Squares
> >
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> > In fact, if you look at the statistics list I am the 5th fastest.
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
> >
> > So -- who can beat me?
> >
> > --
> > Isaac Traxler -- personal e-mail
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>


One small thing you ccan do is to avoid recomputing radius squared and teh
x+ length, y+ length. I added extra fields in my strcut and calculated all
of those values as I read it in sot hat when more than 1 query occurred,
it would not have to recompute.

I di dnot see you on the list, so I submitted your code and got a time of
.016

1) .010
2-5) .012
6) .014
7-13) .016

So it looks like you will show up 14th.

It also looks like the accuracy is to the nearest .002 of a second.

Maybe the suggestion above will buy you an increase -- but maybe not.

I am guessing that converting from c++ to c may buy you .002.

The only othr way I can think of to improve performance (for me also) is
to change the I/O method (scanf is pretty inefficient). I suspect that
.010 of my runtime is in the I/O and .002 is in the computation.

--
Isaac Traxler AIX,Linux Admin
Louisiana State University
High Performance Computing 225-578-1923
LONI AIX Clusters
AIX, Linux Support

On Fri, 3 Aug 2012, Matthew Gavin wrote:

> Date: Fri, 3 Aug 2012 19:59:52 +0000
> From: Matthew Gavin <>
> To: Chris McKnight <>
> Cc: icpc-
> Subject: Re: [Icpc-practice] challenge
>
> rank 6th code =>
> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>
> what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O ? argh!
>
> ---------- Forwarded message ----------
> From: Matthew Gavin <>
> Date: Fri, Aug 3, 2012 at 2:59 PM
> Subject: Re: [Icpc-practice] challenge
> To: Chris McKnight <>
>
>
> rank 6th code =>
> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>
> what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O ? argh!
>
> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <> wrote:
> Starts learning assembly...
>
> Haha I'll look at the problem
>
> Chris McKnight
> Sent from my iPhone
>
> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:
>
> > Okay -- I got a challenge for y'all:
> >
> > I have solved the problem 10823: Of Circles and Squares
> >
> >
> > http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> > In fact, if you look at the statistics list I am the 5th fastest.
> >
> >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
> >
> > So -- who can beat me?
> >
> > --
> > Isaac Traxler -- personal e-mail
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>
>
>
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
hopefully their servers will get updated later. I've submitted like 20
times and it still says my best attempt was 0.036 run time... I'll see
about the precomputations and wonder later about storing the queries in an
array, but yeah, later.

I tried using fgets (which was supposed to cut time from scanf's superb
processing) but then I needed strtok and atoi to grab different values out
of the line. I'm not sure it added overhead, but when I submitted that code
to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
sure what could be cut out of I/O though =\

but yeah, til later.

On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:

> One small thing you ccan do is to avoid recomputing radius squared and teh
> x+ length, y+ length. I added extra fields in my strcut and calculated all
> of those values as I read it in sot hat when more than 1 query occurred, it
> would not have to recompute.
>
> I di dnot see you on the list, so I submitted your code and got a time of
> .016
>
> 1) .010
> 2-5) .012
> 6) .014
> 7-13) .016
>
> So it looks like you will show up 14th.
>
> It also looks like the accuracy is to the nearest .002 of a second.
>
> Maybe the suggestion above will buy you an increase -- but maybe not.
>
> I am guessing that converting from c++ to c may buy you .002.
>
> The only othr way I can think of to improve performance (for me also) is
> to change the I/O method (scanf is pretty inefficient). I suspect that .010
> of my runtime is in the I/O and .002 is in the computation.
>
> --
> Isaac Traxler AIX,Linux Admin
> Louisiana State University
> High Performance Computing 225-578-1923
> LONI AIX Clusters
> AIX, Linux Support
>
> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>
> Date: Fri, 3 Aug 2012 19:59:52 +0000
>> From: Matthew Gavin <>
>> To: Chris McKnight <>
>> Cc: icpc-
>> Subject: Re: [Icpc-practice] challenge
>>
>>
>> rank 6th code =>
>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>
>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>> I/O ? argh!
>>
>> ---------- Forwarded message ----------
>> From: Matthew Gavin <>
>> Date: Fri, Aug 3, 2012 at 2:59 PM
>> Subject: Re: [Icpc-practice] challenge
>> To: Chris McKnight <>
>>
>>
>> rank 6th code =>
>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>
>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>> I/O ? argh!
>>
>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>> wrote:
>> Starts learning assembly...
>>
>> Haha I'll look at the problem
>>
>> Chris McKnight
>> Sent from my iPhone
>>
>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>> wrote:
>>
>> > Okay -- I got a challenge for y'all:
>> >
>> > I have solved the problem 10823: Of Circles and Squares
>> >
>> >
>> > http://uva.onlinejudge.org/**index.php?option=com_**
>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>> >
>> > In fact, if you look at the statistics list I am the 5th fastest.
>> >
>> >http://uva.onlinejudge.org/**index.php?option=com_**
>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>
>> >
>> > So -- who can beat me?
>> >
>> > --
>> > Isaac Traxler -- personal e-mail
>> > ______________________________**_________________
>> > Icpc-practice mailing list
>> > Icpc-
>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>> ______________________________**_________________
>> Icpc-practice mailing list
>> Icpc-
>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>
>>
>>
>>
>>
>>


On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>
> See! I told you ;). 6th.
>
> I wish there were a book on like the lower internals of the system, and
> how to create extremely efficient code and what pitfalls to look for when
> using different methods in C/C++...
> but maybe that information just comes with the teachings of theory in
> higher level CS courses? :\
>
>
> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>
>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>> hopefully their servers will get updated later. I've submitted like 20
>> times and it still says my best attempt was 0.036 run time... I'll see
>> about the precomputations and wonder later about storing the queries in an
>> array, but yeah, later.
>>
>> I tried using fgets (which was supposed to cut time from scanf's superb
>> processing) but then I needed strtok and atoi to grab different values out
>> of the line. I'm not sure it added overhead, but when I submitted that code
>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>> sure what could be cut out of I/O though =\
>>
>> but yeah, til later.
>>
>>
>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>
>>> One small thing you ccan do is to avoid recomputing radius squared and
>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>> all of those values as I read it in sot hat when more than 1 query
>>> occurred, it would not have to recompute.
>>>
>>> I di dnot see you on the list, so I submitted your code and got a time
>>> of .016
>>>
>>> 1) .010
>>> 2-5) .012
>>> 6) .014
>>> 7-13) .016
>>>
>>> So it looks like you will show up 14th.
>>>
>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>
>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>
>>> I am guessing that converting from c++ to c may buy you .002.
>>>
>>> The only othr way I can think of to improve performance (for me also) is
>>> to change the I/O method (scanf is pretty inefficient). I suspect that .010
>>> of my runtime is in the I/O and .002 is in the computation.
>>>
>>> --
>>> Isaac Traxler AIX,Linux Admin
>>> Louisiana State University
>>> High Performance Computing 225-578-1923
>>> LONI AIX Clusters
>>> AIX, Linux Support
>>>
>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>
>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>> From: Matthew Gavin <>
>>>> To: Chris McKnight <>
>>>> Cc: icpc-
>>>> Subject: Re: [Icpc-practice] challenge
>>>>
>>>>
>>>> rank 6th code =>
>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>
>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>> I/O ? argh!
>>>>
>>>> ---------- Forwarded message ----------
>>>> From: Matthew Gavin <>
>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>> Subject: Re: [Icpc-practice] challenge
>>>> To: Chris McKnight <>
>>>>
>>>>
>>>> rank 6th code =>
>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>
>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>> I/O ? argh!
>>>>
>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>> wrote:
>>>> Starts learning assembly...
>>>>
>>>> Haha I'll look at the problem
>>>>
>>>> Chris McKnight
>>>> Sent from my iPhone
>>>>
>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>> wrote:
>>>>
>>>> > Okay -- I got a challenge for y'all:
>>>> >
>>>> > I have solved the problem 10823: Of Circles and Squares
>>>> >
>>>> >
>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>> >
>>>> > In fact, if you look at the statistics list I am the 5th
>>>> fastest.
>>>> >
>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>
>>>> >
>>>> > So -- who can beat me?
>>>> >
>>>> > --
>>>> > Isaac Traxler -- personal e-mail
>>>> > ______________________________**_________________
>>>> > Icpc-practice mailing list
>>>> > Icpc-
>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>> ______________________________**_________________
>>>> Icpc-practice mailing list
>>>> Icpc-
>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>
>


https://raw.github.com/mgavin/acm-code/master/ofcands.c

bit shifts instead of *2, goto's..., compiling in c, no point struct...,
pre-computing px+length and py+length instead of doing it twice.. :\

still 0.12

I don't know anymore...

On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>
>>
>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>
>> See! I told you ;). 6th.
>>
>> I wish there were a book on like the lower internals of the system, and
>> how to create extremely efficient code and what pitfalls to look for when
>> using different methods in C/C++...
>> but maybe that information just comes with the teachings of theory in
>> higher level CS courses? :\
>>
>>
>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>>
>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>>> hopefully their servers will get updated later. I've submitted like 20
>>> times and it still says my best attempt was 0.036 run time... I'll see
>>> about the precomputations and wonder later about storing the queries in an
>>> array, but yeah, later.
>>>
>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>> processing) but then I needed strtok and atoi to grab different values out
>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>> sure what could be cut out of I/O though =\
>>>
>>> but yeah, til later.
>>>
>>>
>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>>
>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>> all of those values as I read it in sot hat when more than 1 query
>>>> occurred, it would not have to recompute.
>>>>
>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>> of .016
>>>>
>>>> 1) .010
>>>> 2-5) .012
>>>> 6) .014
>>>> 7-13) .016
>>>>
>>>> So it looks like you will show up 14th.
>>>>
>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>
>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>
>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>
>>>> The only othr way I can think of to improve performance (for me also)
>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>
>>>> --
>>>> Isaac Traxler AIX,Linux Admin
>>>> Louisiana State University
>>>> High Performance Computing 225-578-1923
>>>> LONI AIX Clusters
>>>> AIX, Linux Support
>>>>
>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>
>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>> From: Matthew Gavin <>
>>>>> To: Chris McKnight <>
>>>>> Cc: icpc-
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> ---------- Forwarded message ----------
>>>>> From: Matthew Gavin <>
>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>> To: Chris McKnight <>
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>>> wrote:
>>>>> Starts learning assembly...
>>>>>
>>>>> Haha I'll look at the problem
>>>>>
>>>>> Chris McKnight
>>>>> Sent from my iPhone
>>>>>
>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>> wrote:
>>>>>
>>>>> > Okay -- I got a challenge for y'all:
>>>>> >
>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>> >
>>>>> >
>>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>>> >
>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>> fastest.
>>>>> >
>>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>>
>>>>> >
>>>>> > So -- who can beat me?
>>>>> >
>>>>> > --
>>>>> > Isaac Traxler -- personal e-mail
>>>>> > ______________________________**_________________
>>>>> > Icpc-practice mailing list
>>>>> > Icpc-
>>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>> ______________________________**_________________
>>>>> Icpc-practice mailing list
>>>>> Icpc-
>>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>
>


That seems to suggest what Isaac said the other day: The majority of
the time is spent handling input/output rather than in computation.

On Sat, Aug 4, 2012 at 1:52 PM, Matthew Gavin <> wrote:
> https://raw.github.com/mgavin/acm-code/master/ofcands.c
>
> bit shifts instead of *2, goto's..., compiling in c, no point struct...,
> pre-computing px+length and py+length instead of doing it twice.. :\
>
> still 0.12
>
> I don't know anymore...
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>
> wrote:
>>
>>
>>
>> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>
>> wrote:
>>>
>>>
>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>>
>>> See! I told you ;). 6th.
>>>
>>> I wish there were a book on like the lower internals of the system, and
>>> how to create extremely efficient code and what pitfalls to look for when
>>> using different methods in C/C++...
>>> but maybe that information just comes with the teachings of theory in
>>> higher level CS courses? :\
>>>
>>>
>>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>
>>> wrote:
>>>>
>>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>>>> hopefully their servers will get updated later. I've submitted like 20 times
>>>> and it still says my best attempt was 0.036 run time... I'll see about the
>>>> precomputations and wonder later about storing the queries in an array, but
>>>> yeah, later.
>>>>
>>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>>> processing) but then I needed strtok and atoi to grab different values out
>>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>>> sure what could be cut out of I/O though =\
>>>>
>>>> but yeah, til later.
>>>>
>>>>
>>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>>>>
>>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>>> all of those values as I read it in sot hat when more than 1 query occurred,
>>>>> it would not have to recompute.
>>>>>
>>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>>> of .016
>>>>>
>>>>> 1) .010
>>>>> 2-5) .012
>>>>> 6) .014
>>>>> 7-13) .016
>>>>>
>>>>> So it looks like you will show up 14th.
>>>>>
>>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>>
>>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>>
>>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>>
>>>>> The only othr way I can think of to improve performance (for me also)
>>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>>
>>>>> --
>>>>> Isaac Traxler AIX,Linux Admin
>>>>> Louisiana State University
>>>>> High Performance Computing 225-578-1923
>>>>> LONI AIX Clusters
>>>>> AIX, Linux Support
>>>>>
>>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>>
>>>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>>> From: Matthew Gavin <>
>>>>>> To: Chris McKnight <>
>>>>>> Cc: icpc-
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>>> I/O ? argh!
>>>>>>
>>>>>> ---------- Forwarded message ----------
>>>>>> From: Matthew Gavin <>
>>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>> To: Chris McKnight <>
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>>> I/O ? argh!
>>>>>>
>>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight
>>>>>> <> wrote:
>>>>>> Starts learning assembly...
>>>>>>
>>>>>> Haha I'll look at the problem
>>>>>>
>>>>>> Chris McKnight
>>>>>> Sent from my iPhone
>>>>>>
>>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>>> wrote:
>>>>>>
>>>>>> > Okay -- I got a challenge for y'all:
>>>>>> >
>>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>>>>>> >
>>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>>> fastest.
>>>>>> >
>>>>>>
>>>>>> >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>>>>>>
>>>>>> >
>>>>>> > So -- who can beat me?
>>>>>> >
>>>>>> > --
>>>>>> > Isaac Traxler -- personal e-mail
>>>>>> > _______________________________________________
>>>>>> > Icpc-practice mailing list
>>>>>> > Icpc-
>>>>>> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>>>>> _______________________________________________
>>>>>> Icpc-practice mailing list
>>>>>> Icpc-
>>>>>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>
>>
>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-172-performance-engineering-of-software-systems-fall-2010/

On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>
>>
>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>
>> See! I told you ;). 6th.
>>
>> I wish there were a book on like the lower internals of the system, and
>> how to create extremely efficient code and what pitfalls to look for when
>> using different methods in C/C++...
>> but maybe that information just comes with the teachings of theory in
>> higher level CS courses? :\
>>
>>
>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>>
>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>>> hopefully their servers will get updated later. I've submitted like 20
>>> times and it still says my best attempt was 0.036 run time... I'll see
>>> about the precomputations and wonder later about storing the queries in an
>>> array, but yeah, later.
>>>
>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>> processing) but then I needed strtok and atoi to grab different values out
>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>> sure what could be cut out of I/O though =\
>>>
>>> but yeah, til later.
>>>
>>>
>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>>
>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>> all of those values as I read it in sot hat when more than 1 query
>>>> occurred, it would not have to recompute.
>>>>
>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>> of .016
>>>>
>>>> 1) .010
>>>> 2-5) .012
>>>> 6) .014
>>>> 7-13) .016
>>>>
>>>> So it looks like you will show up 14th.
>>>>
>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>
>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>
>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>
>>>> The only othr way I can think of to improve performance (for me also)
>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>
>>>> --
>>>> Isaac Traxler AIX,Linux Admin
>>>> Louisiana State University
>>>> High Performance Computing 225-578-1923
>>>> LONI AIX Clusters
>>>> AIX, Linux Support
>>>>
>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>
>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>> From: Matthew Gavin <>
>>>>> To: Chris McKnight <>
>>>>> Cc: icpc-
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> ---------- Forwarded message ----------
>>>>> From: Matthew Gavin <>
>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>> To: Chris McKnight <>
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>>> wrote:
>>>>> Starts learning assembly...
>>>>>
>>>>> Haha I'll look at the problem
>>>>>
>>>>> Chris McKnight
>>>>> Sent from my iPhone
>>>>>
>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>> wrote:
>>>>>
>>>>> > Okay -- I got a challenge for y'all:
>>>>> >
>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>> >
>>>>> >
>>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>>> >
>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>> fastest.
>>>>> >
>>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>>
>>>>> >
>>>>> > So -- who can beat me?
>>>>> >
>>>>> > --
>>>>> > Isaac Traxler -- personal e-mail
>>>>> > ______________________________**_________________
>>>>> > Icpc-practice mailing list
>>>>> > Icpc-
>>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>> ______________________________**_________________
>>>>> Icpc-practice mailing list
>>>>> Icpc-
>>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>


HAAHAHAHA YAY

Got rank 1, 0.008 run time. I went on IRC and asked for I/O speed up help,
and someone suggested strtol :)

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24<-
proof
https://raw.github.com/mgavin/acm-code/master/ofcands.c <- code

^_^, wooooooh

but of course I couldn't have done it without Isaac's suggestions for
speeding up the processing in the first place ;)

On Sat, Aug 4, 2012 at 2:28 PM, Bruno Beltran <>wrote:

>
> http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-172-performance-engineering-of-software-systems-fall-2010/
>
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>
>>
>>
>> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>>
>>>
>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>>
>>> See! I told you ;). 6th.
>>>
>>> I wish there were a book on like the lower internals of the system, and
>>> how to create extremely efficient code and what pitfalls to look for when
>>> using different methods in C/C++...
>>> but maybe that information just comes with the teachings of theory in
>>> higher level CS courses? :\
>>>
>>>
>>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>>>
>>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it,
>>>> so hopefully their servers will get updated later. I've submitted like 20
>>>> times and it still says my best attempt was 0.036 run time... I'll see
>>>> about the precomputations and wonder later about storing the queries in an
>>>> array, but yeah, later.
>>>>
>>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>>> processing) but then I needed strtok and atoi to grab different values out
>>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>>> sure what could be cut out of I/O though =\
>>>>
>>>> but yeah, til later.
>>>>
>>>>
>>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <>wrote:
>>>>
>>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>>> all of those values as I read it in sot hat when more than 1 query
>>>>> occurred, it would not have to recompute.
>>>>>
>>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>>> of .016
>>>>>
>>>>> 1) .010
>>>>> 2-5) .012
>>>>> 6) .014
>>>>> 7-13) .016
>>>>>
>>>>> So it looks like you will show up 14th.
>>>>>
>>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>>
>>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>>
>>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>>
>>>>> The only othr way I can think of to improve performance (for me also)
>>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>>
>>>>> --
>>>>> Isaac Traxler AIX,Linux Admin
>>>>> Louisiana State University
>>>>> High Performance Computing 225-578-1923
>>>>> LONI AIX Clusters
>>>>> AIX, Linux Support
>>>>>
>>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>>
>>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>>> From: Matthew Gavin <>
>>>>>> To: Chris McKnight <>
>>>>>> Cc: icpc-
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math
>>>>>> precision? I/O ? argh!
>>>>>>
>>>>>> ---------- Forwarded message ----------
>>>>>> From: Matthew Gavin <>
>>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>> To: Chris McKnight <>
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math
>>>>>> precision? I/O ? argh!
>>>>>>
>>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <
>>>>>> > wrote:
>>>>>> Starts learning assembly...
>>>>>>
>>>>>> Haha I'll look at the problem
>>>>>>
>>>>>> Chris McKnight
>>>>>> Sent from my iPhone
>>>>>>
>>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>>> wrote:
>>>>>>
>>>>>> > Okay -- I got a challenge for y'all:
>>>>>> >
>>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>>> >
>>>>>> >
>>>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>>>> >
>>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>>> fastest.
>>>>>> >
>>>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>>>
>>>>>> >
>>>>>> > So -- who can beat me?
>>>>>> >
>>>>>> > --
>>>>>> > Isaac Traxler -- personal e-mail
>>>>>> > ______________________________**_________________
>>>>>> > Icpc-practice mailing list
>>>>>> > Icpc-
>>>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>> ______________________________**_________________
>>>>>> Icpc-practice mailing list
>>>>>> Icpc-
>>>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>
>>
>> _______________________________________________
>> Icpc-practice mailing list
>> Icpc-
>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>
>>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>


X

Isaac Traxler <> wrote:

>Okay -- I got a challenge for y'all:
>
>I have solved the problem 10823: Of Circles and Squares
>
>
>http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>
>In fact, if you look at the statistics list I am the 5th fastest.
>
>http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
>So -- who can beat me?
>
>--
>Isaac Traxler -- personal e-mail
>_______________________________________________
>Icpc-practice mailing list
>Icpc-
>http://isaac.lsu.edu/mailman/listinfo/icpc-practice
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
I hate how when I submit the same code to UVA, I get a run time of 0.008
the first time, and 0.012 the second time =\

On Tue, Aug 7, 2012 at 4:30 AM, Kelly <> wrote:

> X
>
> Isaac Traxler <> wrote:
>
> >Okay -- I got a challenge for y'all:
> >
> >I have solved the problem 10823: Of Circles and Squares
> >
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> >In fact, if you look at the statistics list I am the 5th fastest.
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
> >
> >So -- who can beat me?
> >
> >--
> >Isaac Traxler -- personal e-mail
> >_______________________________________________
> >Icpc-practice mailing list
> >Icpc-
> >http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>



  #13  
10-08-2012 06:04 PM
Icpc-practice member admin is online now
User
 

Okay -- I got a challenge for y'all:

I have solved the problem 10823: Of Circles and Squares


http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764

In fact, if you look at the statistics list I am the 5th fastest.

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=

So -- who can beat me?

--
Isaac Traxler -- personal e-mail
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
Starts learning assembly...

Haha I'll look at the problem

Chris McKnight
Sent from my iPhone

On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:

> Okay -- I got a challenge for y'all:
>
> I have solved the problem 10823: Of Circles and Squares
>
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>
> In fact, if you look at the statistics list I am the 5th fastest.
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
> So -- who can beat me?
>
> --
> Isaac Traxler -- personal e-mail
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
rank 6th code =>
https://github.com/mgavin/acm-code/blob/master/ofcands.cpp

what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O
? argh!

---------- Forwarded message ----------
From: Matthew Gavin <>
Date: Fri, Aug 3, 2012 at 2:59 PM
Subject: Re: [Icpc-practice] challenge
To: Chris McKnight <>


rank 6th code =>
https://github.com/mgavin/acm-code/blob/master/ofcands.cpp

what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O
? argh!


On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>wrote:

> Starts learning assembly...
>
> Haha I'll look at the problem
>
> Chris McKnight
> Sent from my iPhone
>
> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:
>
> > Okay -- I got a challenge for y'all:
> >
> > I have solved the problem 10823: Of Circles and Squares
> >
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> > In fact, if you look at the statistics list I am the 5th fastest.
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
> >
> > So -- who can beat me?
> >
> > --
> > Isaac Traxler -- personal e-mail
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>


One small thing you ccan do is to avoid recomputing radius squared and teh
x+ length, y+ length. I added extra fields in my strcut and calculated all
of those values as I read it in sot hat when more than 1 query occurred,
it would not have to recompute.

I di dnot see you on the list, so I submitted your code and got a time of
.016

1) .010
2-5) .012
6) .014
7-13) .016

So it looks like you will show up 14th.

It also looks like the accuracy is to the nearest .002 of a second.

Maybe the suggestion above will buy you an increase -- but maybe not.

I am guessing that converting from c++ to c may buy you .002.

The only othr way I can think of to improve performance (for me also) is
to change the I/O method (scanf is pretty inefficient). I suspect that
.010 of my runtime is in the I/O and .002 is in the computation.

--
Isaac Traxler AIX,Linux Admin
Louisiana State University
High Performance Computing 225-578-1923
LONI AIX Clusters
AIX, Linux Support

On Fri, 3 Aug 2012, Matthew Gavin wrote:

> Date: Fri, 3 Aug 2012 19:59:52 +0000
> From: Matthew Gavin <>
> To: Chris McKnight <>
> Cc: icpc-
> Subject: Re: [Icpc-practice] challenge
>
> rank 6th code =>
> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>
> what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O ? argh!
>
> ---------- Forwarded message ----------
> From: Matthew Gavin <>
> Date: Fri, Aug 3, 2012 at 2:59 PM
> Subject: Re: [Icpc-practice] challenge
> To: Chris McKnight <>
>
>
> rank 6th code =>
> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>
> what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O ? argh!
>
> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <> wrote:
> Starts learning assembly...
>
> Haha I'll look at the problem
>
> Chris McKnight
> Sent from my iPhone
>
> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:
>
> > Okay -- I got a challenge for y'all:
> >
> > I have solved the problem 10823: Of Circles and Squares
> >
> >
> > http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> > In fact, if you look at the statistics list I am the 5th fastest.
> >
> >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
> >
> > So -- who can beat me?
> >
> > --
> > Isaac Traxler -- personal e-mail
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>
>
>
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
hopefully their servers will get updated later. I've submitted like 20
times and it still says my best attempt was 0.036 run time... I'll see
about the precomputations and wonder later about storing the queries in an
array, but yeah, later.

I tried using fgets (which was supposed to cut time from scanf's superb
processing) but then I needed strtok and atoi to grab different values out
of the line. I'm not sure it added overhead, but when I submitted that code
to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
sure what could be cut out of I/O though =\

but yeah, til later.

On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:

> One small thing you ccan do is to avoid recomputing radius squared and teh
> x+ length, y+ length. I added extra fields in my strcut and calculated all
> of those values as I read it in sot hat when more than 1 query occurred, it
> would not have to recompute.
>
> I di dnot see you on the list, so I submitted your code and got a time of
> .016
>
> 1) .010
> 2-5) .012
> 6) .014
> 7-13) .016
>
> So it looks like you will show up 14th.
>
> It also looks like the accuracy is to the nearest .002 of a second.
>
> Maybe the suggestion above will buy you an increase -- but maybe not.
>
> I am guessing that converting from c++ to c may buy you .002.
>
> The only othr way I can think of to improve performance (for me also) is
> to change the I/O method (scanf is pretty inefficient). I suspect that .010
> of my runtime is in the I/O and .002 is in the computation.
>
> --
> Isaac Traxler AIX,Linux Admin
> Louisiana State University
> High Performance Computing 225-578-1923
> LONI AIX Clusters
> AIX, Linux Support
>
> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>
> Date: Fri, 3 Aug 2012 19:59:52 +0000
>> From: Matthew Gavin <>
>> To: Chris McKnight <>
>> Cc: icpc-
>> Subject: Re: [Icpc-practice] challenge
>>
>>
>> rank 6th code =>
>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>
>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>> I/O ? argh!
>>
>> ---------- Forwarded message ----------
>> From: Matthew Gavin <>
>> Date: Fri, Aug 3, 2012 at 2:59 PM
>> Subject: Re: [Icpc-practice] challenge
>> To: Chris McKnight <>
>>
>>
>> rank 6th code =>
>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>
>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>> I/O ? argh!
>>
>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>> wrote:
>> Starts learning assembly...
>>
>> Haha I'll look at the problem
>>
>> Chris McKnight
>> Sent from my iPhone
>>
>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>> wrote:
>>
>> > Okay -- I got a challenge for y'all:
>> >
>> > I have solved the problem 10823: Of Circles and Squares
>> >
>> >
>> > http://uva.onlinejudge.org/**index.php?option=com_**
>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>> >
>> > In fact, if you look at the statistics list I am the 5th fastest.
>> >
>> >http://uva.onlinejudge.org/**index.php?option=com_**
>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>
>> >
>> > So -- who can beat me?
>> >
>> > --
>> > Isaac Traxler -- personal e-mail
>> > ______________________________**_________________
>> > Icpc-practice mailing list
>> > Icpc-
>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>> ______________________________**_________________
>> Icpc-practice mailing list
>> Icpc-
>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>
>>
>>
>>
>>
>>


On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>
> See! I told you ;). 6th.
>
> I wish there were a book on like the lower internals of the system, and
> how to create extremely efficient code and what pitfalls to look for when
> using different methods in C/C++...
> but maybe that information just comes with the teachings of theory in
> higher level CS courses? :\
>
>
> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>
>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>> hopefully their servers will get updated later. I've submitted like 20
>> times and it still says my best attempt was 0.036 run time... I'll see
>> about the precomputations and wonder later about storing the queries in an
>> array, but yeah, later.
>>
>> I tried using fgets (which was supposed to cut time from scanf's superb
>> processing) but then I needed strtok and atoi to grab different values out
>> of the line. I'm not sure it added overhead, but when I submitted that code
>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>> sure what could be cut out of I/O though =\
>>
>> but yeah, til later.
>>
>>
>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>
>>> One small thing you ccan do is to avoid recomputing radius squared and
>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>> all of those values as I read it in sot hat when more than 1 query
>>> occurred, it would not have to recompute.
>>>
>>> I di dnot see you on the list, so I submitted your code and got a time
>>> of .016
>>>
>>> 1) .010
>>> 2-5) .012
>>> 6) .014
>>> 7-13) .016
>>>
>>> So it looks like you will show up 14th.
>>>
>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>
>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>
>>> I am guessing that converting from c++ to c may buy you .002.
>>>
>>> The only othr way I can think of to improve performance (for me also) is
>>> to change the I/O method (scanf is pretty inefficient). I suspect that .010
>>> of my runtime is in the I/O and .002 is in the computation.
>>>
>>> --
>>> Isaac Traxler AIX,Linux Admin
>>> Louisiana State University
>>> High Performance Computing 225-578-1923
>>> LONI AIX Clusters
>>> AIX, Linux Support
>>>
>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>
>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>> From: Matthew Gavin <>
>>>> To: Chris McKnight <>
>>>> Cc: icpc-
>>>> Subject: Re: [Icpc-practice] challenge
>>>>
>>>>
>>>> rank 6th code =>
>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>
>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>> I/O ? argh!
>>>>
>>>> ---------- Forwarded message ----------
>>>> From: Matthew Gavin <>
>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>> Subject: Re: [Icpc-practice] challenge
>>>> To: Chris McKnight <>
>>>>
>>>>
>>>> rank 6th code =>
>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>
>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>> I/O ? argh!
>>>>
>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>> wrote:
>>>> Starts learning assembly...
>>>>
>>>> Haha I'll look at the problem
>>>>
>>>> Chris McKnight
>>>> Sent from my iPhone
>>>>
>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>> wrote:
>>>>
>>>> > Okay -- I got a challenge for y'all:
>>>> >
>>>> > I have solved the problem 10823: Of Circles and Squares
>>>> >
>>>> >
>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>> >
>>>> > In fact, if you look at the statistics list I am the 5th
>>>> fastest.
>>>> >
>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>
>>>> >
>>>> > So -- who can beat me?
>>>> >
>>>> > --
>>>> > Isaac Traxler -- personal e-mail
>>>> > ______________________________**_________________
>>>> > Icpc-practice mailing list
>>>> > Icpc-
>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>> ______________________________**_________________
>>>> Icpc-practice mailing list
>>>> Icpc-
>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>
>


https://raw.github.com/mgavin/acm-code/master/ofcands.c

bit shifts instead of *2, goto's..., compiling in c, no point struct...,
pre-computing px+length and py+length instead of doing it twice.. :\

still 0.12

I don't know anymore...

On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>
>>
>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>
>> See! I told you ;). 6th.
>>
>> I wish there were a book on like the lower internals of the system, and
>> how to create extremely efficient code and what pitfalls to look for when
>> using different methods in C/C++...
>> but maybe that information just comes with the teachings of theory in
>> higher level CS courses? :\
>>
>>
>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>>
>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>>> hopefully their servers will get updated later. I've submitted like 20
>>> times and it still says my best attempt was 0.036 run time... I'll see
>>> about the precomputations and wonder later about storing the queries in an
>>> array, but yeah, later.
>>>
>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>> processing) but then I needed strtok and atoi to grab different values out
>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>> sure what could be cut out of I/O though =\
>>>
>>> but yeah, til later.
>>>
>>>
>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>>
>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>> all of those values as I read it in sot hat when more than 1 query
>>>> occurred, it would not have to recompute.
>>>>
>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>> of .016
>>>>
>>>> 1) .010
>>>> 2-5) .012
>>>> 6) .014
>>>> 7-13) .016
>>>>
>>>> So it looks like you will show up 14th.
>>>>
>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>
>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>
>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>
>>>> The only othr way I can think of to improve performance (for me also)
>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>
>>>> --
>>>> Isaac Traxler AIX,Linux Admin
>>>> Louisiana State University
>>>> High Performance Computing 225-578-1923
>>>> LONI AIX Clusters
>>>> AIX, Linux Support
>>>>
>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>
>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>> From: Matthew Gavin <>
>>>>> To: Chris McKnight <>
>>>>> Cc: icpc-
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> ---------- Forwarded message ----------
>>>>> From: Matthew Gavin <>
>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>> To: Chris McKnight <>
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>>> wrote:
>>>>> Starts learning assembly...
>>>>>
>>>>> Haha I'll look at the problem
>>>>>
>>>>> Chris McKnight
>>>>> Sent from my iPhone
>>>>>
>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>> wrote:
>>>>>
>>>>> > Okay -- I got a challenge for y'all:
>>>>> >
>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>> >
>>>>> >
>>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>>> >
>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>> fastest.
>>>>> >
>>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>>
>>>>> >
>>>>> > So -- who can beat me?
>>>>> >
>>>>> > --
>>>>> > Isaac Traxler -- personal e-mail
>>>>> > ______________________________**_________________
>>>>> > Icpc-practice mailing list
>>>>> > Icpc-
>>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>> ______________________________**_________________
>>>>> Icpc-practice mailing list
>>>>> Icpc-
>>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>
>


That seems to suggest what Isaac said the other day: The majority of
the time is spent handling input/output rather than in computation.

On Sat, Aug 4, 2012 at 1:52 PM, Matthew Gavin <> wrote:
> https://raw.github.com/mgavin/acm-code/master/ofcands.c
>
> bit shifts instead of *2, goto's..., compiling in c, no point struct...,
> pre-computing px+length and py+length instead of doing it twice.. :\
>
> still 0.12
>
> I don't know anymore...
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>
> wrote:
>>
>>
>>
>> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>
>> wrote:
>>>
>>>
>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>>
>>> See! I told you ;). 6th.
>>>
>>> I wish there were a book on like the lower internals of the system, and
>>> how to create extremely efficient code and what pitfalls to look for when
>>> using different methods in C/C++...
>>> but maybe that information just comes with the teachings of theory in
>>> higher level CS courses? :\
>>>
>>>
>>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>
>>> wrote:
>>>>
>>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>>>> hopefully their servers will get updated later. I've submitted like 20 times
>>>> and it still says my best attempt was 0.036 run time... I'll see about the
>>>> precomputations and wonder later about storing the queries in an array, but
>>>> yeah, later.
>>>>
>>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>>> processing) but then I needed strtok and atoi to grab different values out
>>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>>> sure what could be cut out of I/O though =\
>>>>
>>>> but yeah, til later.
>>>>
>>>>
>>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>>>>
>>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>>> all of those values as I read it in sot hat when more than 1 query occurred,
>>>>> it would not have to recompute.
>>>>>
>>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>>> of .016
>>>>>
>>>>> 1) .010
>>>>> 2-5) .012
>>>>> 6) .014
>>>>> 7-13) .016
>>>>>
>>>>> So it looks like you will show up 14th.
>>>>>
>>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>>
>>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>>
>>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>>
>>>>> The only othr way I can think of to improve performance (for me also)
>>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>>
>>>>> --
>>>>> Isaac Traxler AIX,Linux Admin
>>>>> Louisiana State University
>>>>> High Performance Computing 225-578-1923
>>>>> LONI AIX Clusters
>>>>> AIX, Linux Support
>>>>>
>>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>>
>>>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>>> From: Matthew Gavin <>
>>>>>> To: Chris McKnight <>
>>>>>> Cc: icpc-
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>>> I/O ? argh!
>>>>>>
>>>>>> ---------- Forwarded message ----------
>>>>>> From: Matthew Gavin <>
>>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>> To: Chris McKnight <>
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>>> I/O ? argh!
>>>>>>
>>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight
>>>>>> <> wrote:
>>>>>> Starts learning assembly...
>>>>>>
>>>>>> Haha I'll look at the problem
>>>>>>
>>>>>> Chris McKnight
>>>>>> Sent from my iPhone
>>>>>>
>>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>>> wrote:
>>>>>>
>>>>>> > Okay -- I got a challenge for y'all:
>>>>>> >
>>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>>>>>> >
>>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>>> fastest.
>>>>>> >
>>>>>>
>>>>>> >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>>>>>>
>>>>>> >
>>>>>> > So -- who can beat me?
>>>>>> >
>>>>>> > --
>>>>>> > Isaac Traxler -- personal e-mail
>>>>>> > _______________________________________________
>>>>>> > Icpc-practice mailing list
>>>>>> > Icpc-
>>>>>> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>>>>> _______________________________________________
>>>>>> Icpc-practice mailing list
>>>>>> Icpc-
>>>>>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>
>>
>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-172-performance-engineering-of-software-systems-fall-2010/

On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>
>>
>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>
>> See! I told you ;). 6th.
>>
>> I wish there were a book on like the lower internals of the system, and
>> how to create extremely efficient code and what pitfalls to look for when
>> using different methods in C/C++...
>> but maybe that information just comes with the teachings of theory in
>> higher level CS courses? :\
>>
>>
>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>>
>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>>> hopefully their servers will get updated later. I've submitted like 20
>>> times and it still says my best attempt was 0.036 run time... I'll see
>>> about the precomputations and wonder later about storing the queries in an
>>> array, but yeah, later.
>>>
>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>> processing) but then I needed strtok and atoi to grab different values out
>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>> sure what could be cut out of I/O though =\
>>>
>>> but yeah, til later.
>>>
>>>
>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>>
>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>> all of those values as I read it in sot hat when more than 1 query
>>>> occurred, it would not have to recompute.
>>>>
>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>> of .016
>>>>
>>>> 1) .010
>>>> 2-5) .012
>>>> 6) .014
>>>> 7-13) .016
>>>>
>>>> So it looks like you will show up 14th.
>>>>
>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>
>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>
>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>
>>>> The only othr way I can think of to improve performance (for me also)
>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>
>>>> --
>>>> Isaac Traxler AIX,Linux Admin
>>>> Louisiana State University
>>>> High Performance Computing 225-578-1923
>>>> LONI AIX Clusters
>>>> AIX, Linux Support
>>>>
>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>
>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>> From: Matthew Gavin <>
>>>>> To: Chris McKnight <>
>>>>> Cc: icpc-
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> ---------- Forwarded message ----------
>>>>> From: Matthew Gavin <>
>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>> To: Chris McKnight <>
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>>> wrote:
>>>>> Starts learning assembly...
>>>>>
>>>>> Haha I'll look at the problem
>>>>>
>>>>> Chris McKnight
>>>>> Sent from my iPhone
>>>>>
>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>> wrote:
>>>>>
>>>>> > Okay -- I got a challenge for y'all:
>>>>> >
>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>> >
>>>>> >
>>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>>> >
>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>> fastest.
>>>>> >
>>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>>
>>>>> >
>>>>> > So -- who can beat me?
>>>>> >
>>>>> > --
>>>>> > Isaac Traxler -- personal e-mail
>>>>> > ______________________________**_________________
>>>>> > Icpc-practice mailing list
>>>>> > Icpc-
>>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>> ______________________________**_________________
>>>>> Icpc-practice mailing list
>>>>> Icpc-
>>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>


HAAHAHAHA YAY

Got rank 1, 0.008 run time. I went on IRC and asked for I/O speed up help,
and someone suggested strtol :)

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24<-
proof
https://raw.github.com/mgavin/acm-code/master/ofcands.c <- code

^_^, wooooooh

but of course I couldn't have done it without Isaac's suggestions for
speeding up the processing in the first place ;)

On Sat, Aug 4, 2012 at 2:28 PM, Bruno Beltran <>wrote:

>
> http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-172-performance-engineering-of-software-systems-fall-2010/
>
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>
>>
>>
>> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>>
>>>
>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>>
>>> See! I told you ;). 6th.
>>>
>>> I wish there were a book on like the lower internals of the system, and
>>> how to create extremely efficient code and what pitfalls to look for when
>>> using different methods in C/C++...
>>> but maybe that information just comes with the teachings of theory in
>>> higher level CS courses? :\
>>>
>>>
>>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>>>
>>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it,
>>>> so hopefully their servers will get updated later. I've submitted like 20
>>>> times and it still says my best attempt was 0.036 run time... I'll see
>>>> about the precomputations and wonder later about storing the queries in an
>>>> array, but yeah, later.
>>>>
>>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>>> processing) but then I needed strtok and atoi to grab different values out
>>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>>> sure what could be cut out of I/O though =\
>>>>
>>>> but yeah, til later.
>>>>
>>>>
>>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <>wrote:
>>>>
>>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>>> all of those values as I read it in sot hat when more than 1 query
>>>>> occurred, it would not have to recompute.
>>>>>
>>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>>> of .016
>>>>>
>>>>> 1) .010
>>>>> 2-5) .012
>>>>> 6) .014
>>>>> 7-13) .016
>>>>>
>>>>> So it looks like you will show up 14th.
>>>>>
>>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>>
>>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>>
>>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>>
>>>>> The only othr way I can think of to improve performance (for me also)
>>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>>
>>>>> --
>>>>> Isaac Traxler AIX,Linux Admin
>>>>> Louisiana State University
>>>>> High Performance Computing 225-578-1923
>>>>> LONI AIX Clusters
>>>>> AIX, Linux Support
>>>>>
>>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>>
>>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>>> From: Matthew Gavin <>
>>>>>> To: Chris McKnight <>
>>>>>> Cc: icpc-
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math
>>>>>> precision? I/O ? argh!
>>>>>>
>>>>>> ---------- Forwarded message ----------
>>>>>> From: Matthew Gavin <>
>>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>> To: Chris McKnight <>
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math
>>>>>> precision? I/O ? argh!
>>>>>>
>>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <
>>>>>> > wrote:
>>>>>> Starts learning assembly...
>>>>>>
>>>>>> Haha I'll look at the problem
>>>>>>
>>>>>> Chris McKnight
>>>>>> Sent from my iPhone
>>>>>>
>>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>>> wrote:
>>>>>>
>>>>>> > Okay -- I got a challenge for y'all:
>>>>>> >
>>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>>> >
>>>>>> >
>>>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>>>> >
>>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>>> fastest.
>>>>>> >
>>>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>>>
>>>>>> >
>>>>>> > So -- who can beat me?
>>>>>> >
>>>>>> > --
>>>>>> > Isaac Traxler -- personal e-mail
>>>>>> > ______________________________**_________________
>>>>>> > Icpc-practice mailing list
>>>>>> > Icpc-
>>>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>> ______________________________**_________________
>>>>>> Icpc-practice mailing list
>>>>>> Icpc-
>>>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>
>>
>> _______________________________________________
>> Icpc-practice mailing list
>> Icpc-
>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>
>>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>


X

Isaac Traxler <> wrote:

>Okay -- I got a challenge for y'all:
>
>I have solved the problem 10823: Of Circles and Squares
>
>
>http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>
>In fact, if you look at the statistics list I am the 5th fastest.
>
>http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
>So -- who can beat me?
>
>--
>Isaac Traxler -- personal e-mail
>_______________________________________________
>Icpc-practice mailing list
>Icpc-
>http://isaac.lsu.edu/mailman/listinfo/icpc-practice
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
I hate how when I submit the same code to UVA, I get a run time of 0.008
the first time, and 0.012 the second time =\

On Tue, Aug 7, 2012 at 4:30 AM, Kelly <> wrote:

> X
>
> Isaac Traxler <> wrote:
>
> >Okay -- I got a challenge for y'all:
> >
> >I have solved the problem 10823: Of Circles and Squares
> >
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> >In fact, if you look at the statistics list I am the 5th fastest.
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
> >
> >So -- who can beat me?
> >
> >--
> >Isaac Traxler -- personal e-mail
> >_______________________________________________
> >Icpc-practice mailing list
> >Icpc-
> >http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>


Run the same code on your system multiple times, with it in varying
levels of use. You will very rarely get 2 exactly equal timings,
especially over such short periods of time. It also doesn't help that
UVA seems to round their timings off to the nearest .002 or .004, so
an actual difference of .001 could make the displayed time change from
.008 to .012.

Andrew

On Fri, Aug 10, 2012 at 11:56 AM, Matthew Gavin <> wrote:
> I hate how when I submit the same code to UVA, I get a run time of 0.008 the
> first time, and 0.012 the second time =\
>
>
> On Tue, Aug 7, 2012 at 4:30 AM, Kelly <> wrote:
>>
>> X
>>
>> Isaac Traxler <> wrote:
>>
>> >Okay -- I got a challenge for y'all:
>> >
>> >I have solved the problem 10823: Of Circles and Squares
>> >
>> >
>>
>> > >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>> >
>> >In fact, if you look at the statistics list I am the 5th fastest.
>> >
>>
>> > >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>> >
>> >So -- who can beat me?
>> >
>> >--
>> >Isaac Traxler -- personal e-mail
>> >_______________________________________________
>> >Icpc-practice mailing list
>> >Icpc-
>> >http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>> _______________________________________________
>> Icpc-practice mailing list
>> Icpc-
>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)

  #14  
10-08-2012 06:17 PM
Icpc-practice member admin is online now
User
 

Okay -- I got a challenge for y'all:

I have solved the problem 10823: Of Circles and Squares


http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764

In fact, if you look at the statistics list I am the 5th fastest.

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=

So -- who can beat me?

--
Isaac Traxler -- personal e-mail
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
Starts learning assembly...

Haha I'll look at the problem

Chris McKnight
Sent from my iPhone

On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:

> Okay -- I got a challenge for y'all:
>
> I have solved the problem 10823: Of Circles and Squares
>
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>
> In fact, if you look at the statistics list I am the 5th fastest.
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
> So -- who can beat me?
>
> --
> Isaac Traxler -- personal e-mail
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
rank 6th code =>
https://github.com/mgavin/acm-code/blob/master/ofcands.cpp

what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O
? argh!

---------- Forwarded message ----------
From: Matthew Gavin <>
Date: Fri, Aug 3, 2012 at 2:59 PM
Subject: Re: [Icpc-practice] challenge
To: Chris McKnight <>


rank 6th code =>
https://github.com/mgavin/acm-code/blob/master/ofcands.cpp

what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O
? argh!


On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>wrote:

> Starts learning assembly...
>
> Haha I'll look at the problem
>
> Chris McKnight
> Sent from my iPhone
>
> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:
>
> > Okay -- I got a challenge for y'all:
> >
> > I have solved the problem 10823: Of Circles and Squares
> >
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> > In fact, if you look at the statistics list I am the 5th fastest.
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
> >
> > So -- who can beat me?
> >
> > --
> > Isaac Traxler -- personal e-mail
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>


One small thing you ccan do is to avoid recomputing radius squared and teh
x+ length, y+ length. I added extra fields in my strcut and calculated all
of those values as I read it in sot hat when more than 1 query occurred,
it would not have to recompute.

I di dnot see you on the list, so I submitted your code and got a time of
.016

1) .010
2-5) .012
6) .014
7-13) .016

So it looks like you will show up 14th.

It also looks like the accuracy is to the nearest .002 of a second.

Maybe the suggestion above will buy you an increase -- but maybe not.

I am guessing that converting from c++ to c may buy you .002.

The only othr way I can think of to improve performance (for me also) is
to change the I/O method (scanf is pretty inefficient). I suspect that
.010 of my runtime is in the I/O and .002 is in the computation.

--
Isaac Traxler AIX,Linux Admin
Louisiana State University
High Performance Computing 225-578-1923
LONI AIX Clusters
AIX, Linux Support

On Fri, 3 Aug 2012, Matthew Gavin wrote:

> Date: Fri, 3 Aug 2012 19:59:52 +0000
> From: Matthew Gavin <>
> To: Chris McKnight <>
> Cc: icpc-
> Subject: Re: [Icpc-practice] challenge
>
> rank 6th code =>
> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>
> what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O ? argh!
>
> ---------- Forwarded message ----------
> From: Matthew Gavin <>
> Date: Fri, Aug 3, 2012 at 2:59 PM
> Subject: Re: [Icpc-practice] challenge
> To: Chris McKnight <>
>
>
> rank 6th code =>
> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>
> what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O ? argh!
>
> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <> wrote:
> Starts learning assembly...
>
> Haha I'll look at the problem
>
> Chris McKnight
> Sent from my iPhone
>
> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:
>
> > Okay -- I got a challenge for y'all:
> >
> > I have solved the problem 10823: Of Circles and Squares
> >
> >
> > http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> > In fact, if you look at the statistics list I am the 5th fastest.
> >
> >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
> >
> > So -- who can beat me?
> >
> > --
> > Isaac Traxler -- personal e-mail
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>
>
>
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
hopefully their servers will get updated later. I've submitted like 20
times and it still says my best attempt was 0.036 run time... I'll see
about the precomputations and wonder later about storing the queries in an
array, but yeah, later.

I tried using fgets (which was supposed to cut time from scanf's superb
processing) but then I needed strtok and atoi to grab different values out
of the line. I'm not sure it added overhead, but when I submitted that code
to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
sure what could be cut out of I/O though =\

but yeah, til later.

On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:

> One small thing you ccan do is to avoid recomputing radius squared and teh
> x+ length, y+ length. I added extra fields in my strcut and calculated all
> of those values as I read it in sot hat when more than 1 query occurred, it
> would not have to recompute.
>
> I di dnot see you on the list, so I submitted your code and got a time of
> .016
>
> 1) .010
> 2-5) .012
> 6) .014
> 7-13) .016
>
> So it looks like you will show up 14th.
>
> It also looks like the accuracy is to the nearest .002 of a second.
>
> Maybe the suggestion above will buy you an increase -- but maybe not.
>
> I am guessing that converting from c++ to c may buy you .002.
>
> The only othr way I can think of to improve performance (for me also) is
> to change the I/O method (scanf is pretty inefficient). I suspect that .010
> of my runtime is in the I/O and .002 is in the computation.
>
> --
> Isaac Traxler AIX,Linux Admin
> Louisiana State University
> High Performance Computing 225-578-1923
> LONI AIX Clusters
> AIX, Linux Support
>
> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>
> Date: Fri, 3 Aug 2012 19:59:52 +0000
>> From: Matthew Gavin <>
>> To: Chris McKnight <>
>> Cc: icpc-
>> Subject: Re: [Icpc-practice] challenge
>>
>>
>> rank 6th code =>
>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>
>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>> I/O ? argh!
>>
>> ---------- Forwarded message ----------
>> From: Matthew Gavin <>
>> Date: Fri, Aug 3, 2012 at 2:59 PM
>> Subject: Re: [Icpc-practice] challenge
>> To: Chris McKnight <>
>>
>>
>> rank 6th code =>
>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>
>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>> I/O ? argh!
>>
>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>> wrote:
>> Starts learning assembly...
>>
>> Haha I'll look at the problem
>>
>> Chris McKnight
>> Sent from my iPhone
>>
>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>> wrote:
>>
>> > Okay -- I got a challenge for y'all:
>> >
>> > I have solved the problem 10823: Of Circles and Squares
>> >
>> >
>> > http://uva.onlinejudge.org/**index.php?option=com_**
>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>> >
>> > In fact, if you look at the statistics list I am the 5th fastest.
>> >
>> >http://uva.onlinejudge.org/**index.php?option=com_**
>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>
>> >
>> > So -- who can beat me?
>> >
>> > --
>> > Isaac Traxler -- personal e-mail
>> > ______________________________**_________________
>> > Icpc-practice mailing list
>> > Icpc-
>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>> ______________________________**_________________
>> Icpc-practice mailing list
>> Icpc-
>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>
>>
>>
>>
>>
>>


On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>
> See! I told you ;). 6th.
>
> I wish there were a book on like the lower internals of the system, and
> how to create extremely efficient code and what pitfalls to look for when
> using different methods in C/C++...
> but maybe that information just comes with the teachings of theory in
> higher level CS courses? :\
>
>
> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>
>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>> hopefully their servers will get updated later. I've submitted like 20
>> times and it still says my best attempt was 0.036 run time... I'll see
>> about the precomputations and wonder later about storing the queries in an
>> array, but yeah, later.
>>
>> I tried using fgets (which was supposed to cut time from scanf's superb
>> processing) but then I needed strtok and atoi to grab different values out
>> of the line. I'm not sure it added overhead, but when I submitted that code
>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>> sure what could be cut out of I/O though =\
>>
>> but yeah, til later.
>>
>>
>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>
>>> One small thing you ccan do is to avoid recomputing radius squared and
>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>> all of those values as I read it in sot hat when more than 1 query
>>> occurred, it would not have to recompute.
>>>
>>> I di dnot see you on the list, so I submitted your code and got a time
>>> of .016
>>>
>>> 1) .010
>>> 2-5) .012
>>> 6) .014
>>> 7-13) .016
>>>
>>> So it looks like you will show up 14th.
>>>
>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>
>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>
>>> I am guessing that converting from c++ to c may buy you .002.
>>>
>>> The only othr way I can think of to improve performance (for me also) is
>>> to change the I/O method (scanf is pretty inefficient). I suspect that .010
>>> of my runtime is in the I/O and .002 is in the computation.
>>>
>>> --
>>> Isaac Traxler AIX,Linux Admin
>>> Louisiana State University
>>> High Performance Computing 225-578-1923
>>> LONI AIX Clusters
>>> AIX, Linux Support
>>>
>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>
>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>> From: Matthew Gavin <>
>>>> To: Chris McKnight <>
>>>> Cc: icpc-
>>>> Subject: Re: [Icpc-practice] challenge
>>>>
>>>>
>>>> rank 6th code =>
>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>
>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>> I/O ? argh!
>>>>
>>>> ---------- Forwarded message ----------
>>>> From: Matthew Gavin <>
>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>> Subject: Re: [Icpc-practice] challenge
>>>> To: Chris McKnight <>
>>>>
>>>>
>>>> rank 6th code =>
>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>
>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>> I/O ? argh!
>>>>
>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>> wrote:
>>>> Starts learning assembly...
>>>>
>>>> Haha I'll look at the problem
>>>>
>>>> Chris McKnight
>>>> Sent from my iPhone
>>>>
>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>> wrote:
>>>>
>>>> > Okay -- I got a challenge for y'all:
>>>> >
>>>> > I have solved the problem 10823: Of Circles and Squares
>>>> >
>>>> >
>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>> >
>>>> > In fact, if you look at the statistics list I am the 5th
>>>> fastest.
>>>> >
>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>
>>>> >
>>>> > So -- who can beat me?
>>>> >
>>>> > --
>>>> > Isaac Traxler -- personal e-mail
>>>> > ______________________________**_________________
>>>> > Icpc-practice mailing list
>>>> > Icpc-
>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>> ______________________________**_________________
>>>> Icpc-practice mailing list
>>>> Icpc-
>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>
>


https://raw.github.com/mgavin/acm-code/master/ofcands.c

bit shifts instead of *2, goto's..., compiling in c, no point struct...,
pre-computing px+length and py+length instead of doing it twice.. :\

still 0.12

I don't know anymore...

On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>
>>
>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>
>> See! I told you ;). 6th.
>>
>> I wish there were a book on like the lower internals of the system, and
>> how to create extremely efficient code and what pitfalls to look for when
>> using different methods in C/C++...
>> but maybe that information just comes with the teachings of theory in
>> higher level CS courses? :\
>>
>>
>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>>
>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>>> hopefully their servers will get updated later. I've submitted like 20
>>> times and it still says my best attempt was 0.036 run time... I'll see
>>> about the precomputations and wonder later about storing the queries in an
>>> array, but yeah, later.
>>>
>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>> processing) but then I needed strtok and atoi to grab different values out
>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>> sure what could be cut out of I/O though =\
>>>
>>> but yeah, til later.
>>>
>>>
>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>>
>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>> all of those values as I read it in sot hat when more than 1 query
>>>> occurred, it would not have to recompute.
>>>>
>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>> of .016
>>>>
>>>> 1) .010
>>>> 2-5) .012
>>>> 6) .014
>>>> 7-13) .016
>>>>
>>>> So it looks like you will show up 14th.
>>>>
>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>
>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>
>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>
>>>> The only othr way I can think of to improve performance (for me also)
>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>
>>>> --
>>>> Isaac Traxler AIX,Linux Admin
>>>> Louisiana State University
>>>> High Performance Computing 225-578-1923
>>>> LONI AIX Clusters
>>>> AIX, Linux Support
>>>>
>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>
>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>> From: Matthew Gavin <>
>>>>> To: Chris McKnight <>
>>>>> Cc: icpc-
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> ---------- Forwarded message ----------
>>>>> From: Matthew Gavin <>
>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>> To: Chris McKnight <>
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>>> wrote:
>>>>> Starts learning assembly...
>>>>>
>>>>> Haha I'll look at the problem
>>>>>
>>>>> Chris McKnight
>>>>> Sent from my iPhone
>>>>>
>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>> wrote:
>>>>>
>>>>> > Okay -- I got a challenge for y'all:
>>>>> >
>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>> >
>>>>> >
>>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>>> >
>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>> fastest.
>>>>> >
>>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>>
>>>>> >
>>>>> > So -- who can beat me?
>>>>> >
>>>>> > --
>>>>> > Isaac Traxler -- personal e-mail
>>>>> > ______________________________**_________________
>>>>> > Icpc-practice mailing list
>>>>> > Icpc-
>>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>> ______________________________**_________________
>>>>> Icpc-practice mailing list
>>>>> Icpc-
>>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>
>


That seems to suggest what Isaac said the other day: The majority of
the time is spent handling input/output rather than in computation.

On Sat, Aug 4, 2012 at 1:52 PM, Matthew Gavin <> wrote:
> https://raw.github.com/mgavin/acm-code/master/ofcands.c
>
> bit shifts instead of *2, goto's..., compiling in c, no point struct...,
> pre-computing px+length and py+length instead of doing it twice.. :\
>
> still 0.12
>
> I don't know anymore...
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>
> wrote:
>>
>>
>>
>> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>
>> wrote:
>>>
>>>
>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>>
>>> See! I told you ;). 6th.
>>>
>>> I wish there were a book on like the lower internals of the system, and
>>> how to create extremely efficient code and what pitfalls to look for when
>>> using different methods in C/C++...
>>> but maybe that information just comes with the teachings of theory in
>>> higher level CS courses? :\
>>>
>>>
>>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>
>>> wrote:
>>>>
>>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>>>> hopefully their servers will get updated later. I've submitted like 20 times
>>>> and it still says my best attempt was 0.036 run time... I'll see about the
>>>> precomputations and wonder later about storing the queries in an array, but
>>>> yeah, later.
>>>>
>>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>>> processing) but then I needed strtok and atoi to grab different values out
>>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>>> sure what could be cut out of I/O though =\
>>>>
>>>> but yeah, til later.
>>>>
>>>>
>>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>>>>
>>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>>> all of those values as I read it in sot hat when more than 1 query occurred,
>>>>> it would not have to recompute.
>>>>>
>>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>>> of .016
>>>>>
>>>>> 1) .010
>>>>> 2-5) .012
>>>>> 6) .014
>>>>> 7-13) .016
>>>>>
>>>>> So it looks like you will show up 14th.
>>>>>
>>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>>
>>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>>
>>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>>
>>>>> The only othr way I can think of to improve performance (for me also)
>>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>>
>>>>> --
>>>>> Isaac Traxler AIX,Linux Admin
>>>>> Louisiana State University
>>>>> High Performance Computing 225-578-1923
>>>>> LONI AIX Clusters
>>>>> AIX, Linux Support
>>>>>
>>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>>
>>>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>>> From: Matthew Gavin <>
>>>>>> To: Chris McKnight <>
>>>>>> Cc: icpc-
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>>> I/O ? argh!
>>>>>>
>>>>>> ---------- Forwarded message ----------
>>>>>> From: Matthew Gavin <>
>>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>> To: Chris McKnight <>
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>>> I/O ? argh!
>>>>>>
>>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight
>>>>>> <> wrote:
>>>>>> Starts learning assembly...
>>>>>>
>>>>>> Haha I'll look at the problem
>>>>>>
>>>>>> Chris McKnight
>>>>>> Sent from my iPhone
>>>>>>
>>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>>> wrote:
>>>>>>
>>>>>> > Okay -- I got a challenge for y'all:
>>>>>> >
>>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>>>>>> >
>>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>>> fastest.
>>>>>> >
>>>>>>
>>>>>> >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>>>>>>
>>>>>> >
>>>>>> > So -- who can beat me?
>>>>>> >
>>>>>> > --
>>>>>> > Isaac Traxler -- personal e-mail
>>>>>> > _______________________________________________
>>>>>> > Icpc-practice mailing list
>>>>>> > Icpc-
>>>>>> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>>>>> _______________________________________________
>>>>>> Icpc-practice mailing list
>>>>>> Icpc-
>>>>>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>
>>
>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-172-performance-engineering-of-software-systems-fall-2010/

On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>
>>
>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>
>> See! I told you ;). 6th.
>>
>> I wish there were a book on like the lower internals of the system, and
>> how to create extremely efficient code and what pitfalls to look for when
>> using different methods in C/C++...
>> but maybe that information just comes with the teachings of theory in
>> higher level CS courses? :\
>>
>>
>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>>
>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>>> hopefully their servers will get updated later. I've submitted like 20
>>> times and it still says my best attempt was 0.036 run time... I'll see
>>> about the precomputations and wonder later about storing the queries in an
>>> array, but yeah, later.
>>>
>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>> processing) but then I needed strtok and atoi to grab different values out
>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>> sure what could be cut out of I/O though =\
>>>
>>> but yeah, til later.
>>>
>>>
>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>>
>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>> all of those values as I read it in sot hat when more than 1 query
>>>> occurred, it would not have to recompute.
>>>>
>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>> of .016
>>>>
>>>> 1) .010
>>>> 2-5) .012
>>>> 6) .014
>>>> 7-13) .016
>>>>
>>>> So it looks like you will show up 14th.
>>>>
>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>
>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>
>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>
>>>> The only othr way I can think of to improve performance (for me also)
>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>
>>>> --
>>>> Isaac Traxler AIX,Linux Admin
>>>> Louisiana State University
>>>> High Performance Computing 225-578-1923
>>>> LONI AIX Clusters
>>>> AIX, Linux Support
>>>>
>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>
>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>> From: Matthew Gavin <>
>>>>> To: Chris McKnight <>
>>>>> Cc: icpc-
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> ---------- Forwarded message ----------
>>>>> From: Matthew Gavin <>
>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>> To: Chris McKnight <>
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>>> wrote:
>>>>> Starts learning assembly...
>>>>>
>>>>> Haha I'll look at the problem
>>>>>
>>>>> Chris McKnight
>>>>> Sent from my iPhone
>>>>>
>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>> wrote:
>>>>>
>>>>> > Okay -- I got a challenge for y'all:
>>>>> >
>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>> >
>>>>> >
>>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>>> >
>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>> fastest.
>>>>> >
>>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>>
>>>>> >
>>>>> > So -- who can beat me?
>>>>> >
>>>>> > --
>>>>> > Isaac Traxler -- personal e-mail
>>>>> > ______________________________**_________________
>>>>> > Icpc-practice mailing list
>>>>> > Icpc-
>>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>> ______________________________**_________________
>>>>> Icpc-practice mailing list
>>>>> Icpc-
>>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>


HAAHAHAHA YAY

Got rank 1, 0.008 run time. I went on IRC and asked for I/O speed up help,
and someone suggested strtol :)

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24<-
proof
https://raw.github.com/mgavin/acm-code/master/ofcands.c <- code

^_^, wooooooh

but of course I couldn't have done it without Isaac's suggestions for
speeding up the processing in the first place ;)

On Sat, Aug 4, 2012 at 2:28 PM, Bruno Beltran <>wrote:

>
> http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-172-performance-engineering-of-software-systems-fall-2010/
>
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>
>>
>>
>> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>>
>>>
>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>>
>>> See! I told you ;). 6th.
>>>
>>> I wish there were a book on like the lower internals of the system, and
>>> how to create extremely efficient code and what pitfalls to look for when
>>> using different methods in C/C++...
>>> but maybe that information just comes with the teachings of theory in
>>> higher level CS courses? :\
>>>
>>>
>>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>>>
>>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it,
>>>> so hopefully their servers will get updated later. I've submitted like 20
>>>> times and it still says my best attempt was 0.036 run time... I'll see
>>>> about the precomputations and wonder later about storing the queries in an
>>>> array, but yeah, later.
>>>>
>>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>>> processing) but then I needed strtok and atoi to grab different values out
>>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>>> sure what could be cut out of I/O though =\
>>>>
>>>> but yeah, til later.
>>>>
>>>>
>>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <>wrote:
>>>>
>>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>>> all of those values as I read it in sot hat when more than 1 query
>>>>> occurred, it would not have to recompute.
>>>>>
>>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>>> of .016
>>>>>
>>>>> 1) .010
>>>>> 2-5) .012
>>>>> 6) .014
>>>>> 7-13) .016
>>>>>
>>>>> So it looks like you will show up 14th.
>>>>>
>>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>>
>>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>>
>>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>>
>>>>> The only othr way I can think of to improve performance (for me also)
>>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>>
>>>>> --
>>>>> Isaac Traxler AIX,Linux Admin
>>>>> Louisiana State University
>>>>> High Performance Computing 225-578-1923
>>>>> LONI AIX Clusters
>>>>> AIX, Linux Support
>>>>>
>>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>>
>>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>>> From: Matthew Gavin <>
>>>>>> To: Chris McKnight <>
>>>>>> Cc: icpc-
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math
>>>>>> precision? I/O ? argh!
>>>>>>
>>>>>> ---------- Forwarded message ----------
>>>>>> From: Matthew Gavin <>
>>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>> To: Chris McKnight <>
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math
>>>>>> precision? I/O ? argh!
>>>>>>
>>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <
>>>>>> > wrote:
>>>>>> Starts learning assembly...
>>>>>>
>>>>>> Haha I'll look at the problem
>>>>>>
>>>>>> Chris McKnight
>>>>>> Sent from my iPhone
>>>>>>
>>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>>> wrote:
>>>>>>
>>>>>> > Okay -- I got a challenge for y'all:
>>>>>> >
>>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>>> >
>>>>>> >
>>>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>>>> >
>>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>>> fastest.
>>>>>> >
>>>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>>>
>>>>>> >
>>>>>> > So -- who can beat me?
>>>>>> >
>>>>>> > --
>>>>>> > Isaac Traxler -- personal e-mail
>>>>>> > ______________________________**_________________
>>>>>> > Icpc-practice mailing list
>>>>>> > Icpc-
>>>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>> ______________________________**_________________
>>>>>> Icpc-practice mailing list
>>>>>> Icpc-
>>>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>
>>
>> _______________________________________________
>> Icpc-practice mailing list
>> Icpc-
>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>
>>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>


X

Isaac Traxler <> wrote:

>Okay -- I got a challenge for y'all:
>
>I have solved the problem 10823: Of Circles and Squares
>
>
>http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>
>In fact, if you look at the statistics list I am the 5th fastest.
>
>http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
>So -- who can beat me?
>
>--
>Isaac Traxler -- personal e-mail
>_______________________________________________
>Icpc-practice mailing list
>Icpc-
>http://isaac.lsu.edu/mailman/listinfo/icpc-practice
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
I hate how when I submit the same code to UVA, I get a run time of 0.008
the first time, and 0.012 the second time =\

On Tue, Aug 7, 2012 at 4:30 AM, Kelly <> wrote:

> X
>
> Isaac Traxler <> wrote:
>
> >Okay -- I got a challenge for y'all:
> >
> >I have solved the problem 10823: Of Circles and Squares
> >
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> >In fact, if you look at the statistics list I am the 5th fastest.
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
> >
> >So -- who can beat me?
> >
> >--
> >Isaac Traxler -- personal e-mail
> >_______________________________________________
> >Icpc-practice mailing list
> >Icpc-
> >http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>


Run the same code on your system multiple times, with it in varying
levels of use. You will very rarely get 2 exactly equal timings,
especially over such short periods of time. It also doesn't help that
UVA seems to round their timings off to the nearest .002 or .004, so
an actual difference of .001 could make the displayed time change from
.008 to .012.

Andrew

On Fri, Aug 10, 2012 at 11:56 AM, Matthew Gavin <> wrote:
> I hate how when I submit the same code to UVA, I get a run time of 0.008 the
> first time, and 0.012 the second time =\
>
>
> On Tue, Aug 7, 2012 at 4:30 AM, Kelly <> wrote:
>>
>> X
>>
>> Isaac Traxler <> wrote:
>>
>> >Okay -- I got a challenge for y'all:
>> >
>> >I have solved the problem 10823: Of Circles and Squares
>> >
>> >
>>
>> > >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>> >
>> >In fact, if you look at the statistics list I am the 5th fastest.
>> >
>>
>> > >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>> >
>> >So -- who can beat me?
>> >
>> >--
>> >Isaac Traxler -- personal e-mail
>> >_______________________________________________
>> >Icpc-practice mailing list
>> >Icpc-
>> >http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>> _______________________________________________
>> Icpc-practice mailing list
>> Icpc-
>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
All right, I'm not sure how to optimize the printf that outputs the answers
to the rank1 solution to Of Circles and Squares... so if someone finds a
way and beats 0.008, I'd be curious as to what you did :)

The code is in this thread [ ofcands.c ]

On Fri, Aug 10, 2012 at 12:04 PM, Andrew Stewart
<>wrote:

> Run the same code on your system multiple times, with it in varying
> levels of use. You will very rarely get 2 exactly equal timings,
> especially over such short periods of time. It also doesn't help that
> UVA seems to round their timings off to the nearest .002 or .004, so
> an actual difference of .001 could make the displayed time change from
> .008 to .012.
>
> Andrew
>
> On Fri, Aug 10, 2012 at 11:56 AM, Matthew Gavin <>
> wrote:
> > I hate how when I submit the same code to UVA, I get a run time of 0.008
> the
> > first time, and 0.012 the second time =\
> >
> >
> > On Tue, Aug 7, 2012 at 4:30 AM, Kelly <> wrote:
> >>
> >> X
> >>
> >> Isaac Traxler <> wrote:
> >>
> >> >Okay -- I got a challenge for y'all:
> >> >
> >> >I have solved the problem 10823: Of Circles and Squares
> >> >
> >> >
> >>
> >> > >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >> >
> >> >In fact, if you look at the statistics list I am the 5th fastest.
> >> >
> >>
> >> > >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
> >> >
> >> >So -- who can beat me?
> >> >
> >> >--
> >> >Isaac Traxler -- personal e-mail
> >> >_______________________________________________
> >> >Icpc-practice mailing list
> >> >Icpc-
> >> >http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> >> _______________________________________________
> >> Icpc-practice mailing list
> >> Icpc-
> >> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> >
> >
> >
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> >
>



  #15  
10-08-2012 07:37 PM
Icpc-practice member admin is online now
User
 

Okay -- I got a challenge for y'all:

I have solved the problem 10823: Of Circles and Squares


http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764

In fact, if you look at the statistics list I am the 5th fastest.

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=

So -- who can beat me?

--
Isaac Traxler -- personal e-mail
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
Starts learning assembly...

Haha I'll look at the problem

Chris McKnight
Sent from my iPhone

On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:

> Okay -- I got a challenge for y'all:
>
> I have solved the problem 10823: Of Circles and Squares
>
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>
> In fact, if you look at the statistics list I am the 5th fastest.
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
> So -- who can beat me?
>
> --
> Isaac Traxler -- personal e-mail
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
rank 6th code =>
https://github.com/mgavin/acm-code/blob/master/ofcands.cpp

what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O
? argh!

---------- Forwarded message ----------
From: Matthew Gavin <>
Date: Fri, Aug 3, 2012 at 2:59 PM
Subject: Re: [Icpc-practice] challenge
To: Chris McKnight <>


rank 6th code =>
https://github.com/mgavin/acm-code/blob/master/ofcands.cpp

what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O
? argh!


On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>wrote:

> Starts learning assembly...
>
> Haha I'll look at the problem
>
> Chris McKnight
> Sent from my iPhone
>
> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:
>
> > Okay -- I got a challenge for y'all:
> >
> > I have solved the problem 10823: Of Circles and Squares
> >
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> > In fact, if you look at the statistics list I am the 5th fastest.
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
> >
> > So -- who can beat me?
> >
> > --
> > Isaac Traxler -- personal e-mail
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>


One small thing you ccan do is to avoid recomputing radius squared and teh
x+ length, y+ length. I added extra fields in my strcut and calculated all
of those values as I read it in sot hat when more than 1 query occurred,
it would not have to recompute.

I di dnot see you on the list, so I submitted your code and got a time of
.016

1) .010
2-5) .012
6) .014
7-13) .016

So it looks like you will show up 14th.

It also looks like the accuracy is to the nearest .002 of a second.

Maybe the suggestion above will buy you an increase -- but maybe not.

I am guessing that converting from c++ to c may buy you .002.

The only othr way I can think of to improve performance (for me also) is
to change the I/O method (scanf is pretty inefficient). I suspect that
.010 of my runtime is in the I/O and .002 is in the computation.

--
Isaac Traxler AIX,Linux Admin
Louisiana State University
High Performance Computing 225-578-1923
LONI AIX Clusters
AIX, Linux Support

On Fri, 3 Aug 2012, Matthew Gavin wrote:

> Date: Fri, 3 Aug 2012 19:59:52 +0000
> From: Matthew Gavin <>
> To: Chris McKnight <>
> Cc: icpc-
> Subject: Re: [Icpc-practice] challenge
>
> rank 6th code =>
> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>
> what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O ? argh!
>
> ---------- Forwarded message ----------
> From: Matthew Gavin <>
> Date: Fri, Aug 3, 2012 at 2:59 PM
> Subject: Re: [Icpc-practice] challenge
> To: Chris McKnight <>
>
>
> rank 6th code =>
> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>
> what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O ? argh!
>
> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <> wrote:
> Starts learning assembly...
>
> Haha I'll look at the problem
>
> Chris McKnight
> Sent from my iPhone
>
> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:
>
> > Okay -- I got a challenge for y'all:
> >
> > I have solved the problem 10823: Of Circles and Squares
> >
> >
> > http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> > In fact, if you look at the statistics list I am the 5th fastest.
> >
> >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
> >
> > So -- who can beat me?
> >
> > --
> > Isaac Traxler -- personal e-mail
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>
>
>
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
hopefully their servers will get updated later. I've submitted like 20
times and it still says my best attempt was 0.036 run time... I'll see
about the precomputations and wonder later about storing the queries in an
array, but yeah, later.

I tried using fgets (which was supposed to cut time from scanf's superb
processing) but then I needed strtok and atoi to grab different values out
of the line. I'm not sure it added overhead, but when I submitted that code
to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
sure what could be cut out of I/O though =\

but yeah, til later.

On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:

> One small thing you ccan do is to avoid recomputing radius squared and teh
> x+ length, y+ length. I added extra fields in my strcut and calculated all
> of those values as I read it in sot hat when more than 1 query occurred, it
> would not have to recompute.
>
> I di dnot see you on the list, so I submitted your code and got a time of
> .016
>
> 1) .010
> 2-5) .012
> 6) .014
> 7-13) .016
>
> So it looks like you will show up 14th.
>
> It also looks like the accuracy is to the nearest .002 of a second.
>
> Maybe the suggestion above will buy you an increase -- but maybe not.
>
> I am guessing that converting from c++ to c may buy you .002.
>
> The only othr way I can think of to improve performance (for me also) is
> to change the I/O method (scanf is pretty inefficient). I suspect that .010
> of my runtime is in the I/O and .002 is in the computation.
>
> --
> Isaac Traxler AIX,Linux Admin
> Louisiana State University
> High Performance Computing 225-578-1923
> LONI AIX Clusters
> AIX, Linux Support
>
> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>
> Date: Fri, 3 Aug 2012 19:59:52 +0000
>> From: Matthew Gavin <>
>> To: Chris McKnight <>
>> Cc: icpc-
>> Subject: Re: [Icpc-practice] challenge
>>
>>
>> rank 6th code =>
>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>
>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>> I/O ? argh!
>>
>> ---------- Forwarded message ----------
>> From: Matthew Gavin <>
>> Date: Fri, Aug 3, 2012 at 2:59 PM
>> Subject: Re: [Icpc-practice] challenge
>> To: Chris McKnight <>
>>
>>
>> rank 6th code =>
>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>
>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>> I/O ? argh!
>>
>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>> wrote:
>> Starts learning assembly...
>>
>> Haha I'll look at the problem
>>
>> Chris McKnight
>> Sent from my iPhone
>>
>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>> wrote:
>>
>> > Okay -- I got a challenge for y'all:
>> >
>> > I have solved the problem 10823: Of Circles and Squares
>> >
>> >
>> > http://uva.onlinejudge.org/**index.php?option=com_**
>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>> >
>> > In fact, if you look at the statistics list I am the 5th fastest.
>> >
>> >http://uva.onlinejudge.org/**index.php?option=com_**
>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>
>> >
>> > So -- who can beat me?
>> >
>> > --
>> > Isaac Traxler -- personal e-mail
>> > ______________________________**_________________
>> > Icpc-practice mailing list
>> > Icpc-
>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>> ______________________________**_________________
>> Icpc-practice mailing list
>> Icpc-
>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>
>>
>>
>>
>>
>>


On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>
> See! I told you ;). 6th.
>
> I wish there were a book on like the lower internals of the system, and
> how to create extremely efficient code and what pitfalls to look for when
> using different methods in C/C++...
> but maybe that information just comes with the teachings of theory in
> higher level CS courses? :\
>
>
> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>
>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>> hopefully their servers will get updated later. I've submitted like 20
>> times and it still says my best attempt was 0.036 run time... I'll see
>> about the precomputations and wonder later about storing the queries in an
>> array, but yeah, later.
>>
>> I tried using fgets (which was supposed to cut time from scanf's superb
>> processing) but then I needed strtok and atoi to grab different values out
>> of the line. I'm not sure it added overhead, but when I submitted that code
>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>> sure what could be cut out of I/O though =\
>>
>> but yeah, til later.
>>
>>
>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>
>>> One small thing you ccan do is to avoid recomputing radius squared and
>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>> all of those values as I read it in sot hat when more than 1 query
>>> occurred, it would not have to recompute.
>>>
>>> I di dnot see you on the list, so I submitted your code and got a time
>>> of .016
>>>
>>> 1) .010
>>> 2-5) .012
>>> 6) .014
>>> 7-13) .016
>>>
>>> So it looks like you will show up 14th.
>>>
>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>
>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>
>>> I am guessing that converting from c++ to c may buy you .002.
>>>
>>> The only othr way I can think of to improve performance (for me also) is
>>> to change the I/O method (scanf is pretty inefficient). I suspect that .010
>>> of my runtime is in the I/O and .002 is in the computation.
>>>
>>> --
>>> Isaac Traxler AIX,Linux Admin
>>> Louisiana State University
>>> High Performance Computing 225-578-1923
>>> LONI AIX Clusters
>>> AIX, Linux Support
>>>
>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>
>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>> From: Matthew Gavin <>
>>>> To: Chris McKnight <>
>>>> Cc: icpc-
>>>> Subject: Re: [Icpc-practice] challenge
>>>>
>>>>
>>>> rank 6th code =>
>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>
>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>> I/O ? argh!
>>>>
>>>> ---------- Forwarded message ----------
>>>> From: Matthew Gavin <>
>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>> Subject: Re: [Icpc-practice] challenge
>>>> To: Chris McKnight <>
>>>>
>>>>
>>>> rank 6th code =>
>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>
>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>> I/O ? argh!
>>>>
>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>> wrote:
>>>> Starts learning assembly...
>>>>
>>>> Haha I'll look at the problem
>>>>
>>>> Chris McKnight
>>>> Sent from my iPhone
>>>>
>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>> wrote:
>>>>
>>>> > Okay -- I got a challenge for y'all:
>>>> >
>>>> > I have solved the problem 10823: Of Circles and Squares
>>>> >
>>>> >
>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>> >
>>>> > In fact, if you look at the statistics list I am the 5th
>>>> fastest.
>>>> >
>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>
>>>> >
>>>> > So -- who can beat me?
>>>> >
>>>> > --
>>>> > Isaac Traxler -- personal e-mail
>>>> > ______________________________**_________________
>>>> > Icpc-practice mailing list
>>>> > Icpc-
>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>> ______________________________**_________________
>>>> Icpc-practice mailing list
>>>> Icpc-
>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>
>


https://raw.github.com/mgavin/acm-code/master/ofcands.c

bit shifts instead of *2, goto's..., compiling in c, no point struct...,
pre-computing px+length and py+length instead of doing it twice.. :\

still 0.12

I don't know anymore...

On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>
>>
>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>
>> See! I told you ;). 6th.
>>
>> I wish there were a book on like the lower internals of the system, and
>> how to create extremely efficient code and what pitfalls to look for when
>> using different methods in C/C++...
>> but maybe that information just comes with the teachings of theory in
>> higher level CS courses? :\
>>
>>
>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>>
>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>>> hopefully their servers will get updated later. I've submitted like 20
>>> times and it still says my best attempt was 0.036 run time... I'll see
>>> about the precomputations and wonder later about storing the queries in an
>>> array, but yeah, later.
>>>
>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>> processing) but then I needed strtok and atoi to grab different values out
>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>> sure what could be cut out of I/O though =\
>>>
>>> but yeah, til later.
>>>
>>>
>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>>
>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>> all of those values as I read it in sot hat when more than 1 query
>>>> occurred, it would not have to recompute.
>>>>
>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>> of .016
>>>>
>>>> 1) .010
>>>> 2-5) .012
>>>> 6) .014
>>>> 7-13) .016
>>>>
>>>> So it looks like you will show up 14th.
>>>>
>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>
>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>
>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>
>>>> The only othr way I can think of to improve performance (for me also)
>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>
>>>> --
>>>> Isaac Traxler AIX,Linux Admin
>>>> Louisiana State University
>>>> High Performance Computing 225-578-1923
>>>> LONI AIX Clusters
>>>> AIX, Linux Support
>>>>
>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>
>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>> From: Matthew Gavin <>
>>>>> To: Chris McKnight <>
>>>>> Cc: icpc-
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> ---------- Forwarded message ----------
>>>>> From: Matthew Gavin <>
>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>> To: Chris McKnight <>
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>>> wrote:
>>>>> Starts learning assembly...
>>>>>
>>>>> Haha I'll look at the problem
>>>>>
>>>>> Chris McKnight
>>>>> Sent from my iPhone
>>>>>
>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>> wrote:
>>>>>
>>>>> > Okay -- I got a challenge for y'all:
>>>>> >
>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>> >
>>>>> >
>>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>>> >
>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>> fastest.
>>>>> >
>>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>>
>>>>> >
>>>>> > So -- who can beat me?
>>>>> >
>>>>> > --
>>>>> > Isaac Traxler -- personal e-mail
>>>>> > ______________________________**_________________
>>>>> > Icpc-practice mailing list
>>>>> > Icpc-
>>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>> ______________________________**_________________
>>>>> Icpc-practice mailing list
>>>>> Icpc-
>>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>
>


That seems to suggest what Isaac said the other day: The majority of
the time is spent handling input/output rather than in computation.

On Sat, Aug 4, 2012 at 1:52 PM, Matthew Gavin <> wrote:
> https://raw.github.com/mgavin/acm-code/master/ofcands.c
>
> bit shifts instead of *2, goto's..., compiling in c, no point struct...,
> pre-computing px+length and py+length instead of doing it twice.. :\
>
> still 0.12
>
> I don't know anymore...
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>
> wrote:
>>
>>
>>
>> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>
>> wrote:
>>>
>>>
>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>>
>>> See! I told you ;). 6th.
>>>
>>> I wish there were a book on like the lower internals of the system, and
>>> how to create extremely efficient code and what pitfalls to look for when
>>> using different methods in C/C++...
>>> but maybe that information just comes with the teachings of theory in
>>> higher level CS courses? :\
>>>
>>>
>>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>
>>> wrote:
>>>>
>>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>>>> hopefully their servers will get updated later. I've submitted like 20 times
>>>> and it still says my best attempt was 0.036 run time... I'll see about the
>>>> precomputations and wonder later about storing the queries in an array, but
>>>> yeah, later.
>>>>
>>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>>> processing) but then I needed strtok and atoi to grab different values out
>>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>>> sure what could be cut out of I/O though =\
>>>>
>>>> but yeah, til later.
>>>>
>>>>
>>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>>>>
>>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>>> all of those values as I read it in sot hat when more than 1 query occurred,
>>>>> it would not have to recompute.
>>>>>
>>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>>> of .016
>>>>>
>>>>> 1) .010
>>>>> 2-5) .012
>>>>> 6) .014
>>>>> 7-13) .016
>>>>>
>>>>> So it looks like you will show up 14th.
>>>>>
>>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>>
>>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>>
>>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>>
>>>>> The only othr way I can think of to improve performance (for me also)
>>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>>
>>>>> --
>>>>> Isaac Traxler AIX,Linux Admin
>>>>> Louisiana State University
>>>>> High Performance Computing 225-578-1923
>>>>> LONI AIX Clusters
>>>>> AIX, Linux Support
>>>>>
>>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>>
>>>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>>> From: Matthew Gavin <>
>>>>>> To: Chris McKnight <>
>>>>>> Cc: icpc-
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>>> I/O ? argh!
>>>>>>
>>>>>> ---------- Forwarded message ----------
>>>>>> From: Matthew Gavin <>
>>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>> To: Chris McKnight <>
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>>> I/O ? argh!
>>>>>>
>>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight
>>>>>> <> wrote:
>>>>>> Starts learning assembly...
>>>>>>
>>>>>> Haha I'll look at the problem
>>>>>>
>>>>>> Chris McKnight
>>>>>> Sent from my iPhone
>>>>>>
>>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>>> wrote:
>>>>>>
>>>>>> > Okay -- I got a challenge for y'all:
>>>>>> >
>>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>>>>>> >
>>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>>> fastest.
>>>>>> >
>>>>>>
>>>>>> >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>>>>>>
>>>>>> >
>>>>>> > So -- who can beat me?
>>>>>> >
>>>>>> > --
>>>>>> > Isaac Traxler -- personal e-mail
>>>>>> > _______________________________________________
>>>>>> > Icpc-practice mailing list
>>>>>> > Icpc-
>>>>>> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>>>>> _______________________________________________
>>>>>> Icpc-practice mailing list
>>>>>> Icpc-
>>>>>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>
>>
>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-172-performance-engineering-of-software-systems-fall-2010/

On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>
>>
>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>
>> See! I told you ;). 6th.
>>
>> I wish there were a book on like the lower internals of the system, and
>> how to create extremely efficient code and what pitfalls to look for when
>> using different methods in C/C++...
>> but maybe that information just comes with the teachings of theory in
>> higher level CS courses? :\
>>
>>
>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>>
>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>>> hopefully their servers will get updated later. I've submitted like 20
>>> times and it still says my best attempt was 0.036 run time... I'll see
>>> about the precomputations and wonder later about storing the queries in an
>>> array, but yeah, later.
>>>
>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>> processing) but then I needed strtok and atoi to grab different values out
>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>> sure what could be cut out of I/O though =\
>>>
>>> but yeah, til later.
>>>
>>>
>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>>
>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>> all of those values as I read it in sot hat when more than 1 query
>>>> occurred, it would not have to recompute.
>>>>
>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>> of .016
>>>>
>>>> 1) .010
>>>> 2-5) .012
>>>> 6) .014
>>>> 7-13) .016
>>>>
>>>> So it looks like you will show up 14th.
>>>>
>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>
>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>
>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>
>>>> The only othr way I can think of to improve performance (for me also)
>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>
>>>> --
>>>> Isaac Traxler AIX,Linux Admin
>>>> Louisiana State University
>>>> High Performance Computing 225-578-1923
>>>> LONI AIX Clusters
>>>> AIX, Linux Support
>>>>
>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>
>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>> From: Matthew Gavin <>
>>>>> To: Chris McKnight <>
>>>>> Cc: icpc-
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> ---------- Forwarded message ----------
>>>>> From: Matthew Gavin <>
>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>> To: Chris McKnight <>
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>>> wrote:
>>>>> Starts learning assembly...
>>>>>
>>>>> Haha I'll look at the problem
>>>>>
>>>>> Chris McKnight
>>>>> Sent from my iPhone
>>>>>
>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>> wrote:
>>>>>
>>>>> > Okay -- I got a challenge for y'all:
>>>>> >
>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>> >
>>>>> >
>>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>>> >
>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>> fastest.
>>>>> >
>>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>>
>>>>> >
>>>>> > So -- who can beat me?
>>>>> >
>>>>> > --
>>>>> > Isaac Traxler -- personal e-mail
>>>>> > ______________________________**_________________
>>>>> > Icpc-practice mailing list
>>>>> > Icpc-
>>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>> ______________________________**_________________
>>>>> Icpc-practice mailing list
>>>>> Icpc-
>>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>


HAAHAHAHA YAY

Got rank 1, 0.008 run time. I went on IRC and asked for I/O speed up help,
and someone suggested strtol :)

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24<-
proof
https://raw.github.com/mgavin/acm-code/master/ofcands.c <- code

^_^, wooooooh

but of course I couldn't have done it without Isaac's suggestions for
speeding up the processing in the first place ;)

On Sat, Aug 4, 2012 at 2:28 PM, Bruno Beltran <>wrote:

>
> http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-172-performance-engineering-of-software-systems-fall-2010/
>
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>
>>
>>
>> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>>
>>>
>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>>
>>> See! I told you ;). 6th.
>>>
>>> I wish there were a book on like the lower internals of the system, and
>>> how to create extremely efficient code and what pitfalls to look for when
>>> using different methods in C/C++...
>>> but maybe that information just comes with the teachings of theory in
>>> higher level CS courses? :\
>>>
>>>
>>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>>>
>>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it,
>>>> so hopefully their servers will get updated later. I've submitted like 20
>>>> times and it still says my best attempt was 0.036 run time... I'll see
>>>> about the precomputations and wonder later about storing the queries in an
>>>> array, but yeah, later.
>>>>
>>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>>> processing) but then I needed strtok and atoi to grab different values out
>>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>>> sure what could be cut out of I/O though =\
>>>>
>>>> but yeah, til later.
>>>>
>>>>
>>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <>wrote:
>>>>
>>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>>> all of those values as I read it in sot hat when more than 1 query
>>>>> occurred, it would not have to recompute.
>>>>>
>>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>>> of .016
>>>>>
>>>>> 1) .010
>>>>> 2-5) .012
>>>>> 6) .014
>>>>> 7-13) .016
>>>>>
>>>>> So it looks like you will show up 14th.
>>>>>
>>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>>
>>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>>
>>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>>
>>>>> The only othr way I can think of to improve performance (for me also)
>>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>>
>>>>> --
>>>>> Isaac Traxler AIX,Linux Admin
>>>>> Louisiana State University
>>>>> High Performance Computing 225-578-1923
>>>>> LONI AIX Clusters
>>>>> AIX, Linux Support
>>>>>
>>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>>
>>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>>> From: Matthew Gavin <>
>>>>>> To: Chris McKnight <>
>>>>>> Cc: icpc-
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math
>>>>>> precision? I/O ? argh!
>>>>>>
>>>>>> ---------- Forwarded message ----------
>>>>>> From: Matthew Gavin <>
>>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>> To: Chris McKnight <>
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math
>>>>>> precision? I/O ? argh!
>>>>>>
>>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <
>>>>>> > wrote:
>>>>>> Starts learning assembly...
>>>>>>
>>>>>> Haha I'll look at the problem
>>>>>>
>>>>>> Chris McKnight
>>>>>> Sent from my iPhone
>>>>>>
>>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>>> wrote:
>>>>>>
>>>>>> > Okay -- I got a challenge for y'all:
>>>>>> >
>>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>>> >
>>>>>> >
>>>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>>>> >
>>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>>> fastest.
>>>>>> >
>>>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>>>
>>>>>> >
>>>>>> > So -- who can beat me?
>>>>>> >
>>>>>> > --
>>>>>> > Isaac Traxler -- personal e-mail
>>>>>> > ______________________________**_________________
>>>>>> > Icpc-practice mailing list
>>>>>> > Icpc-
>>>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>> ______________________________**_________________
>>>>>> Icpc-practice mailing list
>>>>>> Icpc-
>>>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>
>>
>> _______________________________________________
>> Icpc-practice mailing list
>> Icpc-
>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>
>>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>


X

Isaac Traxler <> wrote:

>Okay -- I got a challenge for y'all:
>
>I have solved the problem 10823: Of Circles and Squares
>
>
>http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>
>In fact, if you look at the statistics list I am the 5th fastest.
>
>http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
>So -- who can beat me?
>
>--
>Isaac Traxler -- personal e-mail
>_______________________________________________
>Icpc-practice mailing list
>Icpc-
>http://isaac.lsu.edu/mailman/listinfo/icpc-practice
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
I hate how when I submit the same code to UVA, I get a run time of 0.008
the first time, and 0.012 the second time =\

On Tue, Aug 7, 2012 at 4:30 AM, Kelly <> wrote:

> X
>
> Isaac Traxler <> wrote:
>
> >Okay -- I got a challenge for y'all:
> >
> >I have solved the problem 10823: Of Circles and Squares
> >
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> >In fact, if you look at the statistics list I am the 5th fastest.
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
> >
> >So -- who can beat me?
> >
> >--
> >Isaac Traxler -- personal e-mail
> >_______________________________________________
> >Icpc-practice mailing list
> >Icpc-
> >http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>


Run the same code on your system multiple times, with it in varying
levels of use. You will very rarely get 2 exactly equal timings,
especially over such short periods of time. It also doesn't help that
UVA seems to round their timings off to the nearest .002 or .004, so
an actual difference of .001 could make the displayed time change from
.008 to .012.

Andrew

On Fri, Aug 10, 2012 at 11:56 AM, Matthew Gavin <> wrote:
> I hate how when I submit the same code to UVA, I get a run time of 0.008 the
> first time, and 0.012 the second time =\
>
>
> On Tue, Aug 7, 2012 at 4:30 AM, Kelly <> wrote:
>>
>> X
>>
>> Isaac Traxler <> wrote:
>>
>> >Okay -- I got a challenge for y'all:
>> >
>> >I have solved the problem 10823: Of Circles and Squares
>> >
>> >
>>
>> > >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>> >
>> >In fact, if you look at the statistics list I am the 5th fastest.
>> >
>>
>> > >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>> >
>> >So -- who can beat me?
>> >
>> >--
>> >Isaac Traxler -- personal e-mail
>> >_______________________________________________
>> >Icpc-practice mailing list
>> >Icpc-
>> >http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>> _______________________________________________
>> Icpc-practice mailing list
>> Icpc-
>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
All right, I'm not sure how to optimize the printf that outputs the answers
to the rank1 solution to Of Circles and Squares... so if someone finds a
way and beats 0.008, I'd be curious as to what you did :)

The code is in this thread [ ofcands.c ]

On Fri, Aug 10, 2012 at 12:04 PM, Andrew Stewart
<>wrote:

> Run the same code on your system multiple times, with it in varying
> levels of use. You will very rarely get 2 exactly equal timings,
> especially over such short periods of time. It also doesn't help that
> UVA seems to round their timings off to the nearest .002 or .004, so
> an actual difference of .001 could make the displayed time change from
> .008 to .012.
>
> Andrew
>
> On Fri, Aug 10, 2012 at 11:56 AM, Matthew Gavin <>
> wrote:
> > I hate how when I submit the same code to UVA, I get a run time of 0.008
> the
> > first time, and 0.012 the second time =\
> >
> >
> > On Tue, Aug 7, 2012 at 4:30 AM, Kelly <> wrote:
> >>
> >> X
> >>
> >> Isaac Traxler <> wrote:
> >>
> >> >Okay -- I got a challenge for y'all:
> >> >
> >> >I have solved the problem 10823: Of Circles and Squares
> >> >
> >> >
> >>
> >> > >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >> >
> >> >In fact, if you look at the statistics list I am the 5th fastest.
> >> >
> >>
> >> > >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
> >> >
> >> >So -- who can beat me?
> >> >
> >> >--
> >> >Isaac Traxler -- personal e-mail
> >> >_______________________________________________
> >> >Icpc-practice mailing list
> >> >Icpc-
> >> >http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> >> _______________________________________________
> >> Icpc-practice mailing list
> >> Icpc-
> >> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> >
> >
> >
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> >
>


It may not be rounding. I suspect they use virtual instances for judging
and that may be as accurate as they can get.

On the other hand, they may have tested and noticed that runtime often
varied by 0.001 regularly and decided to to use .002 increments to reduce
noise.

As to output, something like this might be better:

char buff[255];



buff[0]='(';
# for ease assume numbers are one digit each
buf[1]=R+'0';
buf[2]=',';
buf[3]=' ';
buf[4]=G+'0';
buf[5]=',';
buf[6]=' ';
buf[7]=B+'0';
buf[8]=')';
buf[9]='\n';
buf[10]=0;
fwrite(buff, sizeof(char), 10, stdout)

puts(buff);

This should save time -- the catch is the numbers are not one digit. You
would probably need to use itoa or write a function.

We know the numbers are in the range of 0 to 255.

int myItoA(int num, char *buff[])
{ /* FUNCTION myItoA */
int lngth;

if (10 > num)
{ /* 0-9 */
buff[0]=num+'0';
buff[1]=0;
lntgh=2;
} /* 0-9 */
else
if (100 > num)
{ /* 10 to 99 */
buff[0]=num / 10+'0';
buff[1]=num % 10 + '0';
buff[2]=0;
lngth=3;
} /* 10 to 99 */
else
{ /* 100 to 255 */
buff[0]=num / 100+'0';
buff[1]=num /10 % 10 + '0';
buff[2]=num % 10 + '0';
buff[3]=0;
lngth=4;
} /* 100 to 255 */
return lnght;
} /* FUNCTION myItoA */

buf[0]='(';
offset=myItoA(R, &buf[1]);
buf[offset++] = ',';
buf[offset++] = ' ';
offset=offset + myItoA(G, &buf[offset]);
buf[offset++] = ',';
buf[offset++] = ' ';
offset=offset + myItoA(B, &buf[offset]);
buf[offset++] = ')';
buf[offset++] = '\n';
buf[offset] = 0;
puts(buf);

Is this faster than a printf? Have to try it...


--
Isaac Traxler AIX,Linux Admin
Louisiana State University
High Performance Computing 225-578-1923
LONI AIX Clusters
AIX, Linux Support

On Fri, 10 Aug 2012, Andrew Stewart wrote:

> Date: Fri, 10 Aug 2012 17:04:56 +0000
> From: Andrew Stewart <>
> To: Matthew Gavin <>
> Cc: icpc-, Kelly <>
> Subject: Re: [Icpc-practice] challenge
>
> Run the same code on your system multiple times, with it in varying
> levels of use. You will very rarely get 2 exactly equal timings,
> especially over such short periods of time. It also doesn't help that
> UVA seems to round their timings off to the nearest .002 or .004, so
> an actual difference of .001 could make the displayed time change from
> .008 to .012.
>
> Andrew
>
> On Fri, Aug 10, 2012 at 11:56 AM, Matthew Gavin <> wrote:
>> I hate how when I submit the same code to UVA, I get a run time of 0.008 the
>> first time, and 0.012 the second time =\
>>
>>
>> On Tue, Aug 7, 2012 at 4:30 AM, Kelly <> wrote:
>>>
>>> X
>>>
>>> Isaac Traxler <> wrote:
>>>
>>>> Okay -- I got a challenge for y'all:
>>>>
>>>> I have solved the problem 10823: Of Circles and Squares
>>>>
>>>>
>>>
>>>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>>>>
>>>> In fact, if you look at the statistics list I am the 5th fastest.
>>>>
>>>
>>>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>>>>
>>>> So -- who can beat me?
>>>>
>>>> --
>>>> Isaac Traxler -- personal e-mail
>>>> _______________________________________________
>>>> Icpc-practice mailing list
>>>> Icpc-
>>>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>> _______________________________________________
>>> Icpc-practice mailing list
>>> Icpc-
>>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>
>>
>>
>> _______________________________________________
>> Icpc-practice mailing list
>> Icpc-
>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)

  #16  
10-08-2012 08:34 PM
Icpc-practice member admin is online now
User
 

Okay -- I got a challenge for y'all:

I have solved the problem 10823: Of Circles and Squares


http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764

In fact, if you look at the statistics list I am the 5th fastest.

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=

So -- who can beat me?

--
Isaac Traxler -- personal e-mail
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
Starts learning assembly...

Haha I'll look at the problem

Chris McKnight
Sent from my iPhone

On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:

> Okay -- I got a challenge for y'all:
>
> I have solved the problem 10823: Of Circles and Squares
>
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>
> In fact, if you look at the statistics list I am the 5th fastest.
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
> So -- who can beat me?
>
> --
> Isaac Traxler -- personal e-mail
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
rank 6th code =>
https://github.com/mgavin/acm-code/blob/master/ofcands.cpp

what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O
? argh!

---------- Forwarded message ----------
From: Matthew Gavin <>
Date: Fri, Aug 3, 2012 at 2:59 PM
Subject: Re: [Icpc-practice] challenge
To: Chris McKnight <>


rank 6th code =>
https://github.com/mgavin/acm-code/blob/master/ofcands.cpp

what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O
? argh!


On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>wrote:

> Starts learning assembly...
>
> Haha I'll look at the problem
>
> Chris McKnight
> Sent from my iPhone
>
> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:
>
> > Okay -- I got a challenge for y'all:
> >
> > I have solved the problem 10823: Of Circles and Squares
> >
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> > In fact, if you look at the statistics list I am the 5th fastest.
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
> >
> > So -- who can beat me?
> >
> > --
> > Isaac Traxler -- personal e-mail
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>


One small thing you ccan do is to avoid recomputing radius squared and teh
x+ length, y+ length. I added extra fields in my strcut and calculated all
of those values as I read it in sot hat when more than 1 query occurred,
it would not have to recompute.

I di dnot see you on the list, so I submitted your code and got a time of
.016

1) .010
2-5) .012
6) .014
7-13) .016

So it looks like you will show up 14th.

It also looks like the accuracy is to the nearest .002 of a second.

Maybe the suggestion above will buy you an increase -- but maybe not.

I am guessing that converting from c++ to c may buy you .002.

The only othr way I can think of to improve performance (for me also) is
to change the I/O method (scanf is pretty inefficient). I suspect that
.010 of my runtime is in the I/O and .002 is in the computation.

--
Isaac Traxler AIX,Linux Admin
Louisiana State University
High Performance Computing 225-578-1923
LONI AIX Clusters
AIX, Linux Support

On Fri, 3 Aug 2012, Matthew Gavin wrote:

> Date: Fri, 3 Aug 2012 19:59:52 +0000
> From: Matthew Gavin <>
> To: Chris McKnight <>
> Cc: icpc-
> Subject: Re: [Icpc-practice] challenge
>
> rank 6th code =>
> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>
> what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O ? argh!
>
> ---------- Forwarded message ----------
> From: Matthew Gavin <>
> Date: Fri, Aug 3, 2012 at 2:59 PM
> Subject: Re: [Icpc-practice] challenge
> To: Chris McKnight <>
>
>
> rank 6th code =>
> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>
> what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O ? argh!
>
> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <> wrote:
> Starts learning assembly...
>
> Haha I'll look at the problem
>
> Chris McKnight
> Sent from my iPhone
>
> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:
>
> > Okay -- I got a challenge for y'all:
> >
> > I have solved the problem 10823: Of Circles and Squares
> >
> >
> > http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> > In fact, if you look at the statistics list I am the 5th fastest.
> >
> >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
> >
> > So -- who can beat me?
> >
> > --
> > Isaac Traxler -- personal e-mail
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>
>
>
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
hopefully their servers will get updated later. I've submitted like 20
times and it still says my best attempt was 0.036 run time... I'll see
about the precomputations and wonder later about storing the queries in an
array, but yeah, later.

I tried using fgets (which was supposed to cut time from scanf's superb
processing) but then I needed strtok and atoi to grab different values out
of the line. I'm not sure it added overhead, but when I submitted that code
to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
sure what could be cut out of I/O though =\

but yeah, til later.

On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:

> One small thing you ccan do is to avoid recomputing radius squared and teh
> x+ length, y+ length. I added extra fields in my strcut and calculated all
> of those values as I read it in sot hat when more than 1 query occurred, it
> would not have to recompute.
>
> I di dnot see you on the list, so I submitted your code and got a time of
> .016
>
> 1) .010
> 2-5) .012
> 6) .014
> 7-13) .016
>
> So it looks like you will show up 14th.
>
> It also looks like the accuracy is to the nearest .002 of a second.
>
> Maybe the suggestion above will buy you an increase -- but maybe not.
>
> I am guessing that converting from c++ to c may buy you .002.
>
> The only othr way I can think of to improve performance (for me also) is
> to change the I/O method (scanf is pretty inefficient). I suspect that .010
> of my runtime is in the I/O and .002 is in the computation.
>
> --
> Isaac Traxler AIX,Linux Admin
> Louisiana State University
> High Performance Computing 225-578-1923
> LONI AIX Clusters
> AIX, Linux Support
>
> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>
> Date: Fri, 3 Aug 2012 19:59:52 +0000
>> From: Matthew Gavin <>
>> To: Chris McKnight <>
>> Cc: icpc-
>> Subject: Re: [Icpc-practice] challenge
>>
>>
>> rank 6th code =>
>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>
>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>> I/O ? argh!
>>
>> ---------- Forwarded message ----------
>> From: Matthew Gavin <>
>> Date: Fri, Aug 3, 2012 at 2:59 PM
>> Subject: Re: [Icpc-practice] challenge
>> To: Chris McKnight <>
>>
>>
>> rank 6th code =>
>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>
>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>> I/O ? argh!
>>
>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>> wrote:
>> Starts learning assembly...
>>
>> Haha I'll look at the problem
>>
>> Chris McKnight
>> Sent from my iPhone
>>
>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>> wrote:
>>
>> > Okay -- I got a challenge for y'all:
>> >
>> > I have solved the problem 10823: Of Circles and Squares
>> >
>> >
>> > http://uva.onlinejudge.org/**index.php?option=com_**
>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>> >
>> > In fact, if you look at the statistics list I am the 5th fastest.
>> >
>> >http://uva.onlinejudge.org/**index.php?option=com_**
>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>
>> >
>> > So -- who can beat me?
>> >
>> > --
>> > Isaac Traxler -- personal e-mail
>> > ______________________________**_________________
>> > Icpc-practice mailing list
>> > Icpc-
>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>> ______________________________**_________________
>> Icpc-practice mailing list
>> Icpc-
>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>
>>
>>
>>
>>
>>


On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>
> See! I told you ;). 6th.
>
> I wish there were a book on like the lower internals of the system, and
> how to create extremely efficient code and what pitfalls to look for when
> using different methods in C/C++...
> but maybe that information just comes with the teachings of theory in
> higher level CS courses? :\
>
>
> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>
>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>> hopefully their servers will get updated later. I've submitted like 20
>> times and it still says my best attempt was 0.036 run time... I'll see
>> about the precomputations and wonder later about storing the queries in an
>> array, but yeah, later.
>>
>> I tried using fgets (which was supposed to cut time from scanf's superb
>> processing) but then I needed strtok and atoi to grab different values out
>> of the line. I'm not sure it added overhead, but when I submitted that code
>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>> sure what could be cut out of I/O though =\
>>
>> but yeah, til later.
>>
>>
>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>
>>> One small thing you ccan do is to avoid recomputing radius squared and
>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>> all of those values as I read it in sot hat when more than 1 query
>>> occurred, it would not have to recompute.
>>>
>>> I di dnot see you on the list, so I submitted your code and got a time
>>> of .016
>>>
>>> 1) .010
>>> 2-5) .012
>>> 6) .014
>>> 7-13) .016
>>>
>>> So it looks like you will show up 14th.
>>>
>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>
>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>
>>> I am guessing that converting from c++ to c may buy you .002.
>>>
>>> The only othr way I can think of to improve performance (for me also) is
>>> to change the I/O method (scanf is pretty inefficient). I suspect that .010
>>> of my runtime is in the I/O and .002 is in the computation.
>>>
>>> --
>>> Isaac Traxler AIX,Linux Admin
>>> Louisiana State University
>>> High Performance Computing 225-578-1923
>>> LONI AIX Clusters
>>> AIX, Linux Support
>>>
>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>
>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>> From: Matthew Gavin <>
>>>> To: Chris McKnight <>
>>>> Cc: icpc-
>>>> Subject: Re: [Icpc-practice] challenge
>>>>
>>>>
>>>> rank 6th code =>
>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>
>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>> I/O ? argh!
>>>>
>>>> ---------- Forwarded message ----------
>>>> From: Matthew Gavin <>
>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>> Subject: Re: [Icpc-practice] challenge
>>>> To: Chris McKnight <>
>>>>
>>>>
>>>> rank 6th code =>
>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>
>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>> I/O ? argh!
>>>>
>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>> wrote:
>>>> Starts learning assembly...
>>>>
>>>> Haha I'll look at the problem
>>>>
>>>> Chris McKnight
>>>> Sent from my iPhone
>>>>
>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>> wrote:
>>>>
>>>> > Okay -- I got a challenge for y'all:
>>>> >
>>>> > I have solved the problem 10823: Of Circles and Squares
>>>> >
>>>> >
>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>> >
>>>> > In fact, if you look at the statistics list I am the 5th
>>>> fastest.
>>>> >
>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>
>>>> >
>>>> > So -- who can beat me?
>>>> >
>>>> > --
>>>> > Isaac Traxler -- personal e-mail
>>>> > ______________________________**_________________
>>>> > Icpc-practice mailing list
>>>> > Icpc-
>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>> ______________________________**_________________
>>>> Icpc-practice mailing list
>>>> Icpc-
>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>
>


https://raw.github.com/mgavin/acm-code/master/ofcands.c

bit shifts instead of *2, goto's..., compiling in c, no point struct...,
pre-computing px+length and py+length instead of doing it twice.. :\

still 0.12

I don't know anymore...

On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>
>>
>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>
>> See! I told you ;). 6th.
>>
>> I wish there were a book on like the lower internals of the system, and
>> how to create extremely efficient code and what pitfalls to look for when
>> using different methods in C/C++...
>> but maybe that information just comes with the teachings of theory in
>> higher level CS courses? :\
>>
>>
>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>>
>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>>> hopefully their servers will get updated later. I've submitted like 20
>>> times and it still says my best attempt was 0.036 run time... I'll see
>>> about the precomputations and wonder later about storing the queries in an
>>> array, but yeah, later.
>>>
>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>> processing) but then I needed strtok and atoi to grab different values out
>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>> sure what could be cut out of I/O though =\
>>>
>>> but yeah, til later.
>>>
>>>
>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>>
>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>> all of those values as I read it in sot hat when more than 1 query
>>>> occurred, it would not have to recompute.
>>>>
>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>> of .016
>>>>
>>>> 1) .010
>>>> 2-5) .012
>>>> 6) .014
>>>> 7-13) .016
>>>>
>>>> So it looks like you will show up 14th.
>>>>
>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>
>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>
>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>
>>>> The only othr way I can think of to improve performance (for me also)
>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>
>>>> --
>>>> Isaac Traxler AIX,Linux Admin
>>>> Louisiana State University
>>>> High Performance Computing 225-578-1923
>>>> LONI AIX Clusters
>>>> AIX, Linux Support
>>>>
>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>
>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>> From: Matthew Gavin <>
>>>>> To: Chris McKnight <>
>>>>> Cc: icpc-
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> ---------- Forwarded message ----------
>>>>> From: Matthew Gavin <>
>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>> To: Chris McKnight <>
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>>> wrote:
>>>>> Starts learning assembly...
>>>>>
>>>>> Haha I'll look at the problem
>>>>>
>>>>> Chris McKnight
>>>>> Sent from my iPhone
>>>>>
>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>> wrote:
>>>>>
>>>>> > Okay -- I got a challenge for y'all:
>>>>> >
>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>> >
>>>>> >
>>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>>> >
>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>> fastest.
>>>>> >
>>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>>
>>>>> >
>>>>> > So -- who can beat me?
>>>>> >
>>>>> > --
>>>>> > Isaac Traxler -- personal e-mail
>>>>> > ______________________________**_________________
>>>>> > Icpc-practice mailing list
>>>>> > Icpc-
>>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>> ______________________________**_________________
>>>>> Icpc-practice mailing list
>>>>> Icpc-
>>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>
>


That seems to suggest what Isaac said the other day: The majority of
the time is spent handling input/output rather than in computation.

On Sat, Aug 4, 2012 at 1:52 PM, Matthew Gavin <> wrote:
> https://raw.github.com/mgavin/acm-code/master/ofcands.c
>
> bit shifts instead of *2, goto's..., compiling in c, no point struct...,
> pre-computing px+length and py+length instead of doing it twice.. :\
>
> still 0.12
>
> I don't know anymore...
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>
> wrote:
>>
>>
>>
>> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>
>> wrote:
>>>
>>>
>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>>
>>> See! I told you ;). 6th.
>>>
>>> I wish there were a book on like the lower internals of the system, and
>>> how to create extremely efficient code and what pitfalls to look for when
>>> using different methods in C/C++...
>>> but maybe that information just comes with the teachings of theory in
>>> higher level CS courses? :\
>>>
>>>
>>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>
>>> wrote:
>>>>
>>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>>>> hopefully their servers will get updated later. I've submitted like 20 times
>>>> and it still says my best attempt was 0.036 run time... I'll see about the
>>>> precomputations and wonder later about storing the queries in an array, but
>>>> yeah, later.
>>>>
>>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>>> processing) but then I needed strtok and atoi to grab different values out
>>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>>> sure what could be cut out of I/O though =\
>>>>
>>>> but yeah, til later.
>>>>
>>>>
>>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>>>>
>>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>>> all of those values as I read it in sot hat when more than 1 query occurred,
>>>>> it would not have to recompute.
>>>>>
>>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>>> of .016
>>>>>
>>>>> 1) .010
>>>>> 2-5) .012
>>>>> 6) .014
>>>>> 7-13) .016
>>>>>
>>>>> So it looks like you will show up 14th.
>>>>>
>>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>>
>>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>>
>>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>>
>>>>> The only othr way I can think of to improve performance (for me also)
>>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>>
>>>>> --
>>>>> Isaac Traxler AIX,Linux Admin
>>>>> Louisiana State University
>>>>> High Performance Computing 225-578-1923
>>>>> LONI AIX Clusters
>>>>> AIX, Linux Support
>>>>>
>>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>>
>>>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>>> From: Matthew Gavin <>
>>>>>> To: Chris McKnight <>
>>>>>> Cc: icpc-
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>>> I/O ? argh!
>>>>>>
>>>>>> ---------- Forwarded message ----------
>>>>>> From: Matthew Gavin <>
>>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>> To: Chris McKnight <>
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>>> I/O ? argh!
>>>>>>
>>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight
>>>>>> <> wrote:
>>>>>> Starts learning assembly...
>>>>>>
>>>>>> Haha I'll look at the problem
>>>>>>
>>>>>> Chris McKnight
>>>>>> Sent from my iPhone
>>>>>>
>>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>>> wrote:
>>>>>>
>>>>>> > Okay -- I got a challenge for y'all:
>>>>>> >
>>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>>>>>> >
>>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>>> fastest.
>>>>>> >
>>>>>>
>>>>>> >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>>>>>>
>>>>>> >
>>>>>> > So -- who can beat me?
>>>>>> >
>>>>>> > --
>>>>>> > Isaac Traxler -- personal e-mail
>>>>>> > _______________________________________________
>>>>>> > Icpc-practice mailing list
>>>>>> > Icpc-
>>>>>> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>>>>> _______________________________________________
>>>>>> Icpc-practice mailing list
>>>>>> Icpc-
>>>>>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>
>>
>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-172-performance-engineering-of-software-systems-fall-2010/

On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>
>>
>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>
>> See! I told you ;). 6th.
>>
>> I wish there were a book on like the lower internals of the system, and
>> how to create extremely efficient code and what pitfalls to look for when
>> using different methods in C/C++...
>> but maybe that information just comes with the teachings of theory in
>> higher level CS courses? :\
>>
>>
>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>>
>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>>> hopefully their servers will get updated later. I've submitted like 20
>>> times and it still says my best attempt was 0.036 run time... I'll see
>>> about the precomputations and wonder later about storing the queries in an
>>> array, but yeah, later.
>>>
>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>> processing) but then I needed strtok and atoi to grab different values out
>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>> sure what could be cut out of I/O though =\
>>>
>>> but yeah, til later.
>>>
>>>
>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>>
>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>> all of those values as I read it in sot hat when more than 1 query
>>>> occurred, it would not have to recompute.
>>>>
>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>> of .016
>>>>
>>>> 1) .010
>>>> 2-5) .012
>>>> 6) .014
>>>> 7-13) .016
>>>>
>>>> So it looks like you will show up 14th.
>>>>
>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>
>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>
>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>
>>>> The only othr way I can think of to improve performance (for me also)
>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>
>>>> --
>>>> Isaac Traxler AIX,Linux Admin
>>>> Louisiana State University
>>>> High Performance Computing 225-578-1923
>>>> LONI AIX Clusters
>>>> AIX, Linux Support
>>>>
>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>
>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>> From: Matthew Gavin <>
>>>>> To: Chris McKnight <>
>>>>> Cc: icpc-
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> ---------- Forwarded message ----------
>>>>> From: Matthew Gavin <>
>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>> To: Chris McKnight <>
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>>> wrote:
>>>>> Starts learning assembly...
>>>>>
>>>>> Haha I'll look at the problem
>>>>>
>>>>> Chris McKnight
>>>>> Sent from my iPhone
>>>>>
>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>> wrote:
>>>>>
>>>>> > Okay -- I got a challenge for y'all:
>>>>> >
>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>> >
>>>>> >
>>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>>> >
>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>> fastest.
>>>>> >
>>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>>
>>>>> >
>>>>> > So -- who can beat me?
>>>>> >
>>>>> > --
>>>>> > Isaac Traxler -- personal e-mail
>>>>> > ______________________________**_________________
>>>>> > Icpc-practice mailing list
>>>>> > Icpc-
>>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>> ______________________________**_________________
>>>>> Icpc-practice mailing list
>>>>> Icpc-
>>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>


HAAHAHAHA YAY

Got rank 1, 0.008 run time. I went on IRC and asked for I/O speed up help,
and someone suggested strtol :)

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24<-
proof
https://raw.github.com/mgavin/acm-code/master/ofcands.c <- code

^_^, wooooooh

but of course I couldn't have done it without Isaac's suggestions for
speeding up the processing in the first place ;)

On Sat, Aug 4, 2012 at 2:28 PM, Bruno Beltran <>wrote:

>
> http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-172-performance-engineering-of-software-systems-fall-2010/
>
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>
>>
>>
>> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>>
>>>
>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>>
>>> See! I told you ;). 6th.
>>>
>>> I wish there were a book on like the lower internals of the system, and
>>> how to create extremely efficient code and what pitfalls to look for when
>>> using different methods in C/C++...
>>> but maybe that information just comes with the teachings of theory in
>>> higher level CS courses? :\
>>>
>>>
>>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>>>
>>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it,
>>>> so hopefully their servers will get updated later. I've submitted like 20
>>>> times and it still says my best attempt was 0.036 run time... I'll see
>>>> about the precomputations and wonder later about storing the queries in an
>>>> array, but yeah, later.
>>>>
>>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>>> processing) but then I needed strtok and atoi to grab different values out
>>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>>> sure what could be cut out of I/O though =\
>>>>
>>>> but yeah, til later.
>>>>
>>>>
>>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <>wrote:
>>>>
>>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>>> all of those values as I read it in sot hat when more than 1 query
>>>>> occurred, it would not have to recompute.
>>>>>
>>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>>> of .016
>>>>>
>>>>> 1) .010
>>>>> 2-5) .012
>>>>> 6) .014
>>>>> 7-13) .016
>>>>>
>>>>> So it looks like you will show up 14th.
>>>>>
>>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>>
>>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>>
>>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>>
>>>>> The only othr way I can think of to improve performance (for me also)
>>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>>
>>>>> --
>>>>> Isaac Traxler AIX,Linux Admin
>>>>> Louisiana State University
>>>>> High Performance Computing 225-578-1923
>>>>> LONI AIX Clusters
>>>>> AIX, Linux Support
>>>>>
>>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>>
>>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>>> From: Matthew Gavin <>
>>>>>> To: Chris McKnight <>
>>>>>> Cc: icpc-
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math
>>>>>> precision? I/O ? argh!
>>>>>>
>>>>>> ---------- Forwarded message ----------
>>>>>> From: Matthew Gavin <>
>>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>> To: Chris McKnight <>
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math
>>>>>> precision? I/O ? argh!
>>>>>>
>>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <
>>>>>> > wrote:
>>>>>> Starts learning assembly...
>>>>>>
>>>>>> Haha I'll look at the problem
>>>>>>
>>>>>> Chris McKnight
>>>>>> Sent from my iPhone
>>>>>>
>>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>>> wrote:
>>>>>>
>>>>>> > Okay -- I got a challenge for y'all:
>>>>>> >
>>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>>> >
>>>>>> >
>>>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>>>> >
>>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>>> fastest.
>>>>>> >
>>>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>>>
>>>>>> >
>>>>>> > So -- who can beat me?
>>>>>> >
>>>>>> > --
>>>>>> > Isaac Traxler -- personal e-mail
>>>>>> > ______________________________**_________________
>>>>>> > Icpc-practice mailing list
>>>>>> > Icpc-
>>>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>> ______________________________**_________________
>>>>>> Icpc-practice mailing list
>>>>>> Icpc-
>>>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>
>>
>> _______________________________________________
>> Icpc-practice mailing list
>> Icpc-
>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>
>>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>


X

Isaac Traxler <> wrote:

>Okay -- I got a challenge for y'all:
>
>I have solved the problem 10823: Of Circles and Squares
>
>
>http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>
>In fact, if you look at the statistics list I am the 5th fastest.
>
>http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
>So -- who can beat me?
>
>--
>Isaac Traxler -- personal e-mail
>_______________________________________________
>Icpc-practice mailing list
>Icpc-
>http://isaac.lsu.edu/mailman/listinfo/icpc-practice
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
I hate how when I submit the same code to UVA, I get a run time of 0.008
the first time, and 0.012 the second time =\

On Tue, Aug 7, 2012 at 4:30 AM, Kelly <> wrote:

> X
>
> Isaac Traxler <> wrote:
>
> >Okay -- I got a challenge for y'all:
> >
> >I have solved the problem 10823: Of Circles and Squares
> >
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> >In fact, if you look at the statistics list I am the 5th fastest.
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
> >
> >So -- who can beat me?
> >
> >--
> >Isaac Traxler -- personal e-mail
> >_______________________________________________
> >Icpc-practice mailing list
> >Icpc-
> >http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>


Run the same code on your system multiple times, with it in varying
levels of use. You will very rarely get 2 exactly equal timings,
especially over such short periods of time. It also doesn't help that
UVA seems to round their timings off to the nearest .002 or .004, so
an actual difference of .001 could make the displayed time change from
.008 to .012.

Andrew

On Fri, Aug 10, 2012 at 11:56 AM, Matthew Gavin <> wrote:
> I hate how when I submit the same code to UVA, I get a run time of 0.008 the
> first time, and 0.012 the second time =\
>
>
> On Tue, Aug 7, 2012 at 4:30 AM, Kelly <> wrote:
>>
>> X
>>
>> Isaac Traxler <> wrote:
>>
>> >Okay -- I got a challenge for y'all:
>> >
>> >I have solved the problem 10823: Of Circles and Squares
>> >
>> >
>>
>> > >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>> >
>> >In fact, if you look at the statistics list I am the 5th fastest.
>> >
>>
>> > >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>> >
>> >So -- who can beat me?
>> >
>> >--
>> >Isaac Traxler -- personal e-mail
>> >_______________________________________________
>> >Icpc-practice mailing list
>> >Icpc-
>> >http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>> _______________________________________________
>> Icpc-practice mailing list
>> Icpc-
>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
All right, I'm not sure how to optimize the printf that outputs the answers
to the rank1 solution to Of Circles and Squares... so if someone finds a
way and beats 0.008, I'd be curious as to what you did :)

The code is in this thread [ ofcands.c ]

On Fri, Aug 10, 2012 at 12:04 PM, Andrew Stewart
<>wrote:

> Run the same code on your system multiple times, with it in varying
> levels of use. You will very rarely get 2 exactly equal timings,
> especially over such short periods of time. It also doesn't help that
> UVA seems to round their timings off to the nearest .002 or .004, so
> an actual difference of .001 could make the displayed time change from
> .008 to .012.
>
> Andrew
>
> On Fri, Aug 10, 2012 at 11:56 AM, Matthew Gavin <>
> wrote:
> > I hate how when I submit the same code to UVA, I get a run time of 0.008
> the
> > first time, and 0.012 the second time =\
> >
> >
> > On Tue, Aug 7, 2012 at 4:30 AM, Kelly <> wrote:
> >>
> >> X
> >>
> >> Isaac Traxler <> wrote:
> >>
> >> >Okay -- I got a challenge for y'all:
> >> >
> >> >I have solved the problem 10823: Of Circles and Squares
> >> >
> >> >
> >>
> >> > >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >> >
> >> >In fact, if you look at the statistics list I am the 5th fastest.
> >> >
> >>
> >> > >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
> >> >
> >> >So -- who can beat me?
> >> >
> >> >--
> >> >Isaac Traxler -- personal e-mail
> >> >_______________________________________________
> >> >Icpc-practice mailing list
> >> >Icpc-
> >> >http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> >> _______________________________________________
> >> Icpc-practice mailing list
> >> Icpc-
> >> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> >
> >
> >
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> >
>


It may not be rounding. I suspect they use virtual instances for judging
and that may be as accurate as they can get.

On the other hand, they may have tested and noticed that runtime often
varied by 0.001 regularly and decided to to use .002 increments to reduce
noise.

As to output, something like this might be better:

char buff[255];



buff[0]='(';
# for ease assume numbers are one digit each
buf[1]=R+'0';
buf[2]=',';
buf[3]=' ';
buf[4]=G+'0';
buf[5]=',';
buf[6]=' ';
buf[7]=B+'0';
buf[8]=')';
buf[9]='\n';
buf[10]=0;
fwrite(buff, sizeof(char), 10, stdout)

puts(buff);

This should save time -- the catch is the numbers are not one digit. You
would probably need to use itoa or write a function.

We know the numbers are in the range of 0 to 255.

int myItoA(int num, char *buff[])
{ /* FUNCTION myItoA */
int lngth;

if (10 > num)
{ /* 0-9 */
buff[0]=num+'0';
buff[1]=0;
lntgh=2;
} /* 0-9 */
else
if (100 > num)
{ /* 10 to 99 */
buff[0]=num / 10+'0';
buff[1]=num % 10 + '0';
buff[2]=0;
lngth=3;
} /* 10 to 99 */
else
{ /* 100 to 255 */
buff[0]=num / 100+'0';
buff[1]=num /10 % 10 + '0';
buff[2]=num % 10 + '0';
buff[3]=0;
lngth=4;
} /* 100 to 255 */
return lnght;
} /* FUNCTION myItoA */

buf[0]='(';
offset=myItoA(R, &buf[1]);
buf[offset++] = ',';
buf[offset++] = ' ';
offset=offset + myItoA(G, &buf[offset]);
buf[offset++] = ',';
buf[offset++] = ' ';
offset=offset + myItoA(B, &buf[offset]);
buf[offset++] = ')';
buf[offset++] = '\n';
buf[offset] = 0;
puts(buf);

Is this faster than a printf? Have to try it...


--
Isaac Traxler AIX,Linux Admin
Louisiana State University
High Performance Computing 225-578-1923
LONI AIX Clusters
AIX, Linux Support

On Fri, 10 Aug 2012, Andrew Stewart wrote:

> Date: Fri, 10 Aug 2012 17:04:56 +0000
> From: Andrew Stewart <>
> To: Matthew Gavin <>
> Cc: icpc-, Kelly <>
> Subject: Re: [Icpc-practice] challenge
>
> Run the same code on your system multiple times, with it in varying
> levels of use. You will very rarely get 2 exactly equal timings,
> especially over such short periods of time. It also doesn't help that
> UVA seems to round their timings off to the nearest .002 or .004, so
> an actual difference of .001 could make the displayed time change from
> .008 to .012.
>
> Andrew
>
> On Fri, Aug 10, 2012 at 11:56 AM, Matthew Gavin <> wrote:
>> I hate how when I submit the same code to UVA, I get a run time of 0.008 the
>> first time, and 0.012 the second time =\
>>
>>
>> On Tue, Aug 7, 2012 at 4:30 AM, Kelly <> wrote:
>>>
>>> X
>>>
>>> Isaac Traxler <> wrote:
>>>
>>>> Okay -- I got a challenge for y'all:
>>>>
>>>> I have solved the problem 10823: Of Circles and Squares
>>>>
>>>>
>>>
>>>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>>>>
>>>> In fact, if you look at the statistics list I am the 5th fastest.
>>>>
>>>
>>>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>>>>
>>>> So -- who can beat me?
>>>>
>>>> --
>>>> Isaac Traxler -- personal e-mail
>>>> _______________________________________________
>>>> Icpc-practice mailing list
>>>> Icpc-
>>>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>> _______________________________________________
>>> Icpc-practice mailing list
>>> Icpc-
>>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>
>>
>>
>> _______________________________________________
>> Icpc-practice mailing list
>> Icpc-
>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
I incorporated your function into my code, but the runtime is the same:

code:
https://raw.github.com/mgavin/acm-code/master/ofcands.c

My Submissions
# Problem Verdict
Language Run Time Submission Date
1046094210823 Of Circles and Squares Accepted ANSI C
0.008 2012-08-10 19:29:58


> On Fri, Aug 10, 2012 at 1:37 PM, Isaac W Traxler <> wrote:
>>
>> It may not be rounding. I suspect they use virtual instances for judging
and that may be as accurate as they can get.
>>
>> On the other hand, they may have tested and noticed that runtime often
varied by 0.001 regularly and decided to to use .002 increments to reduce
noise.
>>
>> As to output, something like this might be better:
>>
>> char buff[255];
>>
>>
>>
>> buff[0]='(';
>> # for ease assume numbers are one digit each
>> buf[1]=R+'0';
>> buf[2]=',';
>> buf[3]=' ';
>> buf[4]=G+'0';
>> buf[5]=',';
>> buf[6]=' ';
>> buf[7]=B+'0';
>> buf[8]=')';
>> buf[9]='\n';
>> buf[10]=0;
>> fwrite(buff, sizeof(char), 10, stdout)
>>
>> puts(buff);
>>
>> This should save time -- the catch is the numbers are not one digit. You
would probably need to use itoa or write a function.
>>
>> We know the numbers are in the range of 0 to 255.
>>
>> int myItoA(int num, char *buff[])
>> { /* FUNCTION myItoA */
>> int lngth;
>>
>> if (10 > num)
>> { /* 0-9 */
>> buff[0]=num+'0';
>> buff[1]=0;
>> lntgh=2;
>> } /* 0-9 */
>> else
>> if (100 > num)
>> { /* 10 to 99 */
>> buff[0]=num / 10+'0';
>> buff[1]=num % 10 + '0';
>> buff[2]=0;
>> lngth=3;
>> } /* 10 to 99 */
>> else
>> { /* 100 to 255 */
>> buff[0]=num / 100+'0';
>> buff[1]=num /10 % 10 + '0';
>> buff[2]=num % 10 + '0';
>> buff[3]=0;
>> lngth=4;
>> } /* 100 to 255 */
>> return lnght;
>> } /* FUNCTION myItoA */
>>
>> buf[0]='(';
>> offset=myItoA(R, &buf[1]);
>> buf[offset++] = ',';
>> buf[offset++] = ' ';
>> offset=offset + myItoA(G, &buf[offset]);
>> buf[offset++] = ',';
>> buf[offset++] = ' ';
>> offset=offset + myItoA(B, &buf[offset]);
>> buf[offset++] = ')';
>> buf[offset++] = '\n';
>> buf[offset] = 0;
>> puts(buf);
>>
>> Is this faster than a printf? Have to try it...
>>
>>
>>
>> --
>> Isaac Traxler AIX,Linux Admin
>> Louisiana State University
>> High Performance Computing 225-578-1923
>> LONI AIX Clusters
>> AIX, Linux Support
>>
>> On Fri, 10 Aug 2012, Andrew Stewart wrote:
>>
>>> Date: Fri, 10 Aug 2012 17:04:56 +0000
>>> From: Andrew Stewart <>
>>> To: Matthew Gavin <>
>>> Cc: icpc-, Kelly <>
>>> Subject: Re: [Icpc-practice] challenge
>>>
>>>
>>> Run the same code on your system multiple times, with it in varying
>>> levels of use. You will very rarely get 2 exactly equal timings,
>>> especially over such short periods of time. It also doesn't help that
>>> UVA seems to round their timings off to the nearest .002 or .004, so
>>> an actual difference of .001 could make the displayed time change from
>>> .008 to .012.
>>>
>>> Andrew
>>>
>>> On Fri, Aug 10, 2012 at 11:56 AM, Matthew Gavin <>
wrote:
>>>>
>>>> I hate how when I submit the same code to UVA, I get a run time of
0.008 the
>>>> first time, and 0.012 the second time =\
>>>>
>>>>
>>>> On Tue, Aug 7, 2012 at 4:30 AM, Kelly <> wrote:
>>>>>
>>>>>
>>>>> X
>>>>>
>>>>> Isaac Traxler <> wrote:
>>>>>
>>>>>> Okay -- I got a challenge for y'all:
>>>>>>
>>>>>> I have solved the problem 10823: Of Circles and Squares
>>>>>>
>>>>>>
>>>>>
>>>>>>>
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>>>>>>
>>>>>>
>>>>>> In fact, if you look at the statistics list I am the 5th fastest.
>>>>>>
>>>>>
>>>>>>>
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>>>>>>
>>>>>>
>>>>>> So -- who can beat me?
>>>>>>
>>>>>> --
>>>>>> Isaac Traxler -- personal e-mail
>>>>>> _______________________________________________
>>>>>> Icpc-practice mailing list
>>>>>> Icpc-
>>>>>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>>>>
>>>>> _______________________________________________
>>>>> Icpc-practice mailing list
>>>>> Icpc-
>>>>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Icpc-practice mailing list
>>>> Icpc-
>>>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>>>
>>> _______________________________________________
>>> Icpc-practice mailing list
>>> Icpc-
>>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>>
>>>



  #17  
10-08-2012 10:18 PM
Icpc-practice member admin is online now
User
 

Okay -- I got a challenge for y'all:

I have solved the problem 10823: Of Circles and Squares


http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764

In fact, if you look at the statistics list I am the 5th fastest.

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=

So -- who can beat me?

--
Isaac Traxler -- personal e-mail
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
Starts learning assembly...

Haha I'll look at the problem

Chris McKnight
Sent from my iPhone

On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:

> Okay -- I got a challenge for y'all:
>
> I have solved the problem 10823: Of Circles and Squares
>
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>
> In fact, if you look at the statistics list I am the 5th fastest.
>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
> So -- who can beat me?
>
> --
> Isaac Traxler -- personal e-mail
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
rank 6th code =>
https://github.com/mgavin/acm-code/blob/master/ofcands.cpp

what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O
? argh!

---------- Forwarded message ----------
From: Matthew Gavin <>
Date: Fri, Aug 3, 2012 at 2:59 PM
Subject: Re: [Icpc-practice] challenge
To: Chris McKnight <>


rank 6th code =>
https://github.com/mgavin/acm-code/blob/master/ofcands.cpp

what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O
? argh!


On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>wrote:

> Starts learning assembly...
>
> Haha I'll look at the problem
>
> Chris McKnight
> Sent from my iPhone
>
> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:
>
> > Okay -- I got a challenge for y'all:
> >
> > I have solved the problem 10823: Of Circles and Squares
> >
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> > In fact, if you look at the statistics list I am the 5th fastest.
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
> >
> > So -- who can beat me?
> >
> > --
> > Isaac Traxler -- personal e-mail
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>


One small thing you ccan do is to avoid recomputing radius squared and teh
x+ length, y+ length. I added extra fields in my strcut and calculated all
of those values as I read it in sot hat when more than 1 query occurred,
it would not have to recompute.

I di dnot see you on the list, so I submitted your code and got a time of
.016

1) .010
2-5) .012
6) .014
7-13) .016

So it looks like you will show up 14th.

It also looks like the accuracy is to the nearest .002 of a second.

Maybe the suggestion above will buy you an increase -- but maybe not.

I am guessing that converting from c++ to c may buy you .002.

The only othr way I can think of to improve performance (for me also) is
to change the I/O method (scanf is pretty inefficient). I suspect that
.010 of my runtime is in the I/O and .002 is in the computation.

--
Isaac Traxler AIX,Linux Admin
Louisiana State University
High Performance Computing 225-578-1923
LONI AIX Clusters
AIX, Linux Support

On Fri, 3 Aug 2012, Matthew Gavin wrote:

> Date: Fri, 3 Aug 2012 19:59:52 +0000
> From: Matthew Gavin <>
> To: Chris McKnight <>
> Cc: icpc-
> Subject: Re: [Icpc-practice] challenge
>
> rank 6th code =>
> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>
> what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O ? argh!
>
> ---------- Forwarded message ----------
> From: Matthew Gavin <>
> Date: Fri, Aug 3, 2012 at 2:59 PM
> Subject: Re: [Icpc-practice] challenge
> To: Chris McKnight <>
>
>
> rank 6th code =>
> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>
> what could possibly get it lower?! :\\\\\ ugghhh, more math precision? I/O ? argh!
>
> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <> wrote:
> Starts learning assembly...
>
> Haha I'll look at the problem
>
> Chris McKnight
> Sent from my iPhone
>
> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <> wrote:
>
> > Okay -- I got a challenge for y'all:
> >
> > I have solved the problem 10823: Of Circles and Squares
> >
> >
> > http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> > In fact, if you look at the statistics list I am the 5th fastest.
> >
> >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
> >
> > So -- who can beat me?
> >
> > --
> > Isaac Traxler -- personal e-mail
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>
>
>
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
hopefully their servers will get updated later. I've submitted like 20
times and it still says my best attempt was 0.036 run time... I'll see
about the precomputations and wonder later about storing the queries in an
array, but yeah, later.

I tried using fgets (which was supposed to cut time from scanf's superb
processing) but then I needed strtok and atoi to grab different values out
of the line. I'm not sure it added overhead, but when I submitted that code
to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
sure what could be cut out of I/O though =\

but yeah, til later.

On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:

> One small thing you ccan do is to avoid recomputing radius squared and teh
> x+ length, y+ length. I added extra fields in my strcut and calculated all
> of those values as I read it in sot hat when more than 1 query occurred, it
> would not have to recompute.
>
> I di dnot see you on the list, so I submitted your code and got a time of
> .016
>
> 1) .010
> 2-5) .012
> 6) .014
> 7-13) .016
>
> So it looks like you will show up 14th.
>
> It also looks like the accuracy is to the nearest .002 of a second.
>
> Maybe the suggestion above will buy you an increase -- but maybe not.
>
> I am guessing that converting from c++ to c may buy you .002.
>
> The only othr way I can think of to improve performance (for me also) is
> to change the I/O method (scanf is pretty inefficient). I suspect that .010
> of my runtime is in the I/O and .002 is in the computation.
>
> --
> Isaac Traxler AIX,Linux Admin
> Louisiana State University
> High Performance Computing 225-578-1923
> LONI AIX Clusters
> AIX, Linux Support
>
> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>
> Date: Fri, 3 Aug 2012 19:59:52 +0000
>> From: Matthew Gavin <>
>> To: Chris McKnight <>
>> Cc: icpc-
>> Subject: Re: [Icpc-practice] challenge
>>
>>
>> rank 6th code =>
>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>
>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>> I/O ? argh!
>>
>> ---------- Forwarded message ----------
>> From: Matthew Gavin <>
>> Date: Fri, Aug 3, 2012 at 2:59 PM
>> Subject: Re: [Icpc-practice] challenge
>> To: Chris McKnight <>
>>
>>
>> rank 6th code =>
>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>
>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>> I/O ? argh!
>>
>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>> wrote:
>> Starts learning assembly...
>>
>> Haha I'll look at the problem
>>
>> Chris McKnight
>> Sent from my iPhone
>>
>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>> wrote:
>>
>> > Okay -- I got a challenge for y'all:
>> >
>> > I have solved the problem 10823: Of Circles and Squares
>> >
>> >
>> > http://uva.onlinejudge.org/**index.php?option=com_**
>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>> >
>> > In fact, if you look at the statistics list I am the 5th fastest.
>> >
>> >http://uva.onlinejudge.org/**index.php?option=com_**
>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>
>> >
>> > So -- who can beat me?
>> >
>> > --
>> > Isaac Traxler -- personal e-mail
>> > ______________________________**_________________
>> > Icpc-practice mailing list
>> > Icpc-
>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>> ______________________________**_________________
>> Icpc-practice mailing list
>> Icpc-
>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>
>>
>>
>>
>>
>>


On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>
> See! I told you ;). 6th.
>
> I wish there were a book on like the lower internals of the system, and
> how to create extremely efficient code and what pitfalls to look for when
> using different methods in C/C++...
> but maybe that information just comes with the teachings of theory in
> higher level CS courses? :\
>
>
> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>
>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>> hopefully their servers will get updated later. I've submitted like 20
>> times and it still says my best attempt was 0.036 run time... I'll see
>> about the precomputations and wonder later about storing the queries in an
>> array, but yeah, later.
>>
>> I tried using fgets (which was supposed to cut time from scanf's superb
>> processing) but then I needed strtok and atoi to grab different values out
>> of the line. I'm not sure it added overhead, but when I submitted that code
>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>> sure what could be cut out of I/O though =\
>>
>> but yeah, til later.
>>
>>
>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>
>>> One small thing you ccan do is to avoid recomputing radius squared and
>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>> all of those values as I read it in sot hat when more than 1 query
>>> occurred, it would not have to recompute.
>>>
>>> I di dnot see you on the list, so I submitted your code and got a time
>>> of .016
>>>
>>> 1) .010
>>> 2-5) .012
>>> 6) .014
>>> 7-13) .016
>>>
>>> So it looks like you will show up 14th.
>>>
>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>
>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>
>>> I am guessing that converting from c++ to c may buy you .002.
>>>
>>> The only othr way I can think of to improve performance (for me also) is
>>> to change the I/O method (scanf is pretty inefficient). I suspect that .010
>>> of my runtime is in the I/O and .002 is in the computation.
>>>
>>> --
>>> Isaac Traxler AIX,Linux Admin
>>> Louisiana State University
>>> High Performance Computing 225-578-1923
>>> LONI AIX Clusters
>>> AIX, Linux Support
>>>
>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>
>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>> From: Matthew Gavin <>
>>>> To: Chris McKnight <>
>>>> Cc: icpc-
>>>> Subject: Re: [Icpc-practice] challenge
>>>>
>>>>
>>>> rank 6th code =>
>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>
>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>> I/O ? argh!
>>>>
>>>> ---------- Forwarded message ----------
>>>> From: Matthew Gavin <>
>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>> Subject: Re: [Icpc-practice] challenge
>>>> To: Chris McKnight <>
>>>>
>>>>
>>>> rank 6th code =>
>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>
>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>> I/O ? argh!
>>>>
>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>> wrote:
>>>> Starts learning assembly...
>>>>
>>>> Haha I'll look at the problem
>>>>
>>>> Chris McKnight
>>>> Sent from my iPhone
>>>>
>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>> wrote:
>>>>
>>>> > Okay -- I got a challenge for y'all:
>>>> >
>>>> > I have solved the problem 10823: Of Circles and Squares
>>>> >
>>>> >
>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>> >
>>>> > In fact, if you look at the statistics list I am the 5th
>>>> fastest.
>>>> >
>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>
>>>> >
>>>> > So -- who can beat me?
>>>> >
>>>> > --
>>>> > Isaac Traxler -- personal e-mail
>>>> > ______________________________**_________________
>>>> > Icpc-practice mailing list
>>>> > Icpc-
>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>> ______________________________**_________________
>>>> Icpc-practice mailing list
>>>> Icpc-
>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>
>


https://raw.github.com/mgavin/acm-code/master/ofcands.c

bit shifts instead of *2, goto's..., compiling in c, no point struct...,
pre-computing px+length and py+length instead of doing it twice.. :\

still 0.12

I don't know anymore...

On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>
>>
>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>
>> See! I told you ;). 6th.
>>
>> I wish there were a book on like the lower internals of the system, and
>> how to create extremely efficient code and what pitfalls to look for when
>> using different methods in C/C++...
>> but maybe that information just comes with the teachings of theory in
>> higher level CS courses? :\
>>
>>
>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>>
>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>>> hopefully their servers will get updated later. I've submitted like 20
>>> times and it still says my best attempt was 0.036 run time... I'll see
>>> about the precomputations and wonder later about storing the queries in an
>>> array, but yeah, later.
>>>
>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>> processing) but then I needed strtok and atoi to grab different values out
>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>> sure what could be cut out of I/O though =\
>>>
>>> but yeah, til later.
>>>
>>>
>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>>
>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>> all of those values as I read it in sot hat when more than 1 query
>>>> occurred, it would not have to recompute.
>>>>
>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>> of .016
>>>>
>>>> 1) .010
>>>> 2-5) .012
>>>> 6) .014
>>>> 7-13) .016
>>>>
>>>> So it looks like you will show up 14th.
>>>>
>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>
>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>
>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>
>>>> The only othr way I can think of to improve performance (for me also)
>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>
>>>> --
>>>> Isaac Traxler AIX,Linux Admin
>>>> Louisiana State University
>>>> High Performance Computing 225-578-1923
>>>> LONI AIX Clusters
>>>> AIX, Linux Support
>>>>
>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>
>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>> From: Matthew Gavin <>
>>>>> To: Chris McKnight <>
>>>>> Cc: icpc-
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> ---------- Forwarded message ----------
>>>>> From: Matthew Gavin <>
>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>> To: Chris McKnight <>
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>>> wrote:
>>>>> Starts learning assembly...
>>>>>
>>>>> Haha I'll look at the problem
>>>>>
>>>>> Chris McKnight
>>>>> Sent from my iPhone
>>>>>
>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>> wrote:
>>>>>
>>>>> > Okay -- I got a challenge for y'all:
>>>>> >
>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>> >
>>>>> >
>>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>>> >
>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>> fastest.
>>>>> >
>>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>>
>>>>> >
>>>>> > So -- who can beat me?
>>>>> >
>>>>> > --
>>>>> > Isaac Traxler -- personal e-mail
>>>>> > ______________________________**_________________
>>>>> > Icpc-practice mailing list
>>>>> > Icpc-
>>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>> ______________________________**_________________
>>>>> Icpc-practice mailing list
>>>>> Icpc-
>>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>
>


That seems to suggest what Isaac said the other day: The majority of
the time is spent handling input/output rather than in computation.

On Sat, Aug 4, 2012 at 1:52 PM, Matthew Gavin <> wrote:
> https://raw.github.com/mgavin/acm-code/master/ofcands.c
>
> bit shifts instead of *2, goto's..., compiling in c, no point struct...,
> pre-computing px+length and py+length instead of doing it twice.. :\
>
> still 0.12
>
> I don't know anymore...
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>
> wrote:
>>
>>
>>
>> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>
>> wrote:
>>>
>>>
>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>>
>>> See! I told you ;). 6th.
>>>
>>> I wish there were a book on like the lower internals of the system, and
>>> how to create extremely efficient code and what pitfalls to look for when
>>> using different methods in C/C++...
>>> but maybe that information just comes with the teachings of theory in
>>> higher level CS courses? :\
>>>
>>>
>>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>
>>> wrote:
>>>>
>>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>>>> hopefully their servers will get updated later. I've submitted like 20 times
>>>> and it still says my best attempt was 0.036 run time... I'll see about the
>>>> precomputations and wonder later about storing the queries in an array, but
>>>> yeah, later.
>>>>
>>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>>> processing) but then I needed strtok and atoi to grab different values out
>>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>>> sure what could be cut out of I/O though =\
>>>>
>>>> but yeah, til later.
>>>>
>>>>
>>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>>>>
>>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>>> all of those values as I read it in sot hat when more than 1 query occurred,
>>>>> it would not have to recompute.
>>>>>
>>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>>> of .016
>>>>>
>>>>> 1) .010
>>>>> 2-5) .012
>>>>> 6) .014
>>>>> 7-13) .016
>>>>>
>>>>> So it looks like you will show up 14th.
>>>>>
>>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>>
>>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>>
>>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>>
>>>>> The only othr way I can think of to improve performance (for me also)
>>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>>
>>>>> --
>>>>> Isaac Traxler AIX,Linux Admin
>>>>> Louisiana State University
>>>>> High Performance Computing 225-578-1923
>>>>> LONI AIX Clusters
>>>>> AIX, Linux Support
>>>>>
>>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>>
>>>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>>> From: Matthew Gavin <>
>>>>>> To: Chris McKnight <>
>>>>>> Cc: icpc-
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>>> I/O ? argh!
>>>>>>
>>>>>> ---------- Forwarded message ----------
>>>>>> From: Matthew Gavin <>
>>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>> To: Chris McKnight <>
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>>> I/O ? argh!
>>>>>>
>>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight
>>>>>> <> wrote:
>>>>>> Starts learning assembly...
>>>>>>
>>>>>> Haha I'll look at the problem
>>>>>>
>>>>>> Chris McKnight
>>>>>> Sent from my iPhone
>>>>>>
>>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>>> wrote:
>>>>>>
>>>>>> > Okay -- I got a challenge for y'all:
>>>>>> >
>>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>>>>>> >
>>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>>> fastest.
>>>>>> >
>>>>>>
>>>>>> >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>>>>>>
>>>>>> >
>>>>>> > So -- who can beat me?
>>>>>> >
>>>>>> > --
>>>>>> > Isaac Traxler -- personal e-mail
>>>>>> > _______________________________________________
>>>>>> > Icpc-practice mailing list
>>>>>> > Icpc-
>>>>>> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>>>>> _______________________________________________
>>>>>> Icpc-practice mailing list
>>>>>> Icpc-
>>>>>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>
>>
>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-172-performance-engineering-of-software-systems-fall-2010/

On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:

>
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>
>>
>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>
>> See! I told you ;). 6th.
>>
>> I wish there were a book on like the lower internals of the system, and
>> how to create extremely efficient code and what pitfalls to look for when
>> using different methods in C/C++...
>> but maybe that information just comes with the teachings of theory in
>> higher level CS courses? :\
>>
>>
>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>>
>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it, so
>>> hopefully their servers will get updated later. I've submitted like 20
>>> times and it still says my best attempt was 0.036 run time... I'll see
>>> about the precomputations and wonder later about storing the queries in an
>>> array, but yeah, later.
>>>
>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>> processing) but then I needed strtok and atoi to grab different values out
>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>> sure what could be cut out of I/O though =\
>>>
>>> but yeah, til later.
>>>
>>>
>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <> wrote:
>>>
>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>> all of those values as I read it in sot hat when more than 1 query
>>>> occurred, it would not have to recompute.
>>>>
>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>> of .016
>>>>
>>>> 1) .010
>>>> 2-5) .012
>>>> 6) .014
>>>> 7-13) .016
>>>>
>>>> So it looks like you will show up 14th.
>>>>
>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>
>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>
>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>
>>>> The only othr way I can think of to improve performance (for me also)
>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>
>>>> --
>>>> Isaac Traxler AIX,Linux Admin
>>>> Louisiana State University
>>>> High Performance Computing 225-578-1923
>>>> LONI AIX Clusters
>>>> AIX, Linux Support
>>>>
>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>
>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>> From: Matthew Gavin <>
>>>>> To: Chris McKnight <>
>>>>> Cc: icpc-
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> ---------- Forwarded message ----------
>>>>> From: Matthew Gavin <>
>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>> Subject: Re: [Icpc-practice] challenge
>>>>> To: Chris McKnight <>
>>>>>
>>>>>
>>>>> rank 6th code =>
>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>
>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math precision?
>>>>> I/O ? argh!
>>>>>
>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <>
>>>>> wrote:
>>>>> Starts learning assembly...
>>>>>
>>>>> Haha I'll look at the problem
>>>>>
>>>>> Chris McKnight
>>>>> Sent from my iPhone
>>>>>
>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>> wrote:
>>>>>
>>>>> > Okay -- I got a challenge for y'all:
>>>>> >
>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>> >
>>>>> >
>>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>>> >
>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>> fastest.
>>>>> >
>>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>>
>>>>> >
>>>>> > So -- who can beat me?
>>>>> >
>>>>> > --
>>>>> > Isaac Traxler -- personal e-mail
>>>>> > ______________________________**_________________
>>>>> > Icpc-practice mailing list
>>>>> > Icpc-
>>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>> ______________________________**_________________
>>>>> Icpc-practice mailing list
>>>>> Icpc-
>>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>


HAAHAHAHA YAY

Got rank 1, 0.008 run time. I went on IRC and asked for I/O speed up help,
and someone suggested strtol :)

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24<-
proof
https://raw.github.com/mgavin/acm-code/master/ofcands.c <- code

^_^, wooooooh

but of course I couldn't have done it without Isaac's suggestions for
speeding up the processing in the first place ;)

On Sat, Aug 4, 2012 at 2:28 PM, Bruno Beltran <>wrote:

>
> http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-172-performance-engineering-of-software-systems-fall-2010/
>
>
> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>
>>
>>
>> On Sat, Aug 4, 2012 at 11:52 AM, Matthew Gavin <>wrote:
>>
>>>
>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=24
>>>
>>> See! I told you ;). 6th.
>>>
>>> I wish there were a book on like the lower internals of the system, and
>>> how to create extremely efficient code and what pitfalls to look for when
>>> using different methods in C/C++...
>>> but maybe that information just comes with the teachings of theory in
>>> higher level CS courses? :\
>>>
>>>
>>> On Fri, Aug 3, 2012 at 4:37 PM, Matthew Gavin <>wrote:
>>>
>>>> I swear I made 0.012 (6th) with my code on github. UHunt reported it,
>>>> so hopefully their servers will get updated later. I've submitted like 20
>>>> times and it still says my best attempt was 0.036 run time... I'll see
>>>> about the precomputations and wonder later about storing the queries in an
>>>> array, but yeah, later.
>>>>
>>>> I tried using fgets (which was supposed to cut time from scanf's superb
>>>> processing) but then I needed strtok and atoi to grab different values out
>>>> of the line. I'm not sure it added overhead, but when I submitted that code
>>>> to UVA I got 0.016 again :\. sooo it seems like scanf is better... I'm not
>>>> sure what could be cut out of I/O though =\
>>>>
>>>> but yeah, til later.
>>>>
>>>>
>>>> On Fri, Aug 3, 2012 at 3:44 PM, Isaac W Traxler <>wrote:
>>>>
>>>>> One small thing you ccan do is to avoid recomputing radius squared and
>>>>> teh x+ length, y+ length. I added extra fields in my strcut and calculated
>>>>> all of those values as I read it in sot hat when more than 1 query
>>>>> occurred, it would not have to recompute.
>>>>>
>>>>> I di dnot see you on the list, so I submitted your code and got a time
>>>>> of .016
>>>>>
>>>>> 1) .010
>>>>> 2-5) .012
>>>>> 6) .014
>>>>> 7-13) .016
>>>>>
>>>>> So it looks like you will show up 14th.
>>>>>
>>>>> It also looks like the accuracy is to the nearest .002 of a second.
>>>>>
>>>>> Maybe the suggestion above will buy you an increase -- but maybe not.
>>>>>
>>>>> I am guessing that converting from c++ to c may buy you .002.
>>>>>
>>>>> The only othr way I can think of to improve performance (for me also)
>>>>> is to change the I/O method (scanf is pretty inefficient). I suspect that
>>>>> .010 of my runtime is in the I/O and .002 is in the computation.
>>>>>
>>>>> --
>>>>> Isaac Traxler AIX,Linux Admin
>>>>> Louisiana State University
>>>>> High Performance Computing 225-578-1923
>>>>> LONI AIX Clusters
>>>>> AIX, Linux Support
>>>>>
>>>>> On Fri, 3 Aug 2012, Matthew Gavin wrote:
>>>>>
>>>>> Date: Fri, 3 Aug 2012 19:59:52 +0000
>>>>>> From: Matthew Gavin <>
>>>>>> To: Chris McKnight <>
>>>>>> Cc: icpc-
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math
>>>>>> precision? I/O ? argh!
>>>>>>
>>>>>> ---------- Forwarded message ----------
>>>>>> From: Matthew Gavin <>
>>>>>> Date: Fri, Aug 3, 2012 at 2:59 PM
>>>>>> Subject: Re: [Icpc-practice] challenge
>>>>>> To: Chris McKnight <>
>>>>>>
>>>>>>
>>>>>> rank 6th code =>
>>>>>> https://github.com/mgavin/acm-**code/blob/master/ofcands.cpp
>>>>>>
>>>>>> what could possibly get it lower?! :\\\\\ ugghhh, more math
>>>>>> precision? I/O ? argh!
>>>>>>
>>>>>> On Wed, Aug 1, 2012 at 6:21 PM, Chris McKnight <
>>>>>> > wrote:
>>>>>> Starts learning assembly...
>>>>>>
>>>>>> Haha I'll look at the problem
>>>>>>
>>>>>> Chris McKnight
>>>>>> Sent from my iPhone
>>>>>>
>>>>>> On Aug 1, 2012, at 4:58 PM, Isaac Traxler <>
>>>>>> wrote:
>>>>>>
>>>>>> > Okay -- I got a challenge for y'all:
>>>>>> >
>>>>>> > I have solved the problem 10823: Of Circles and Squares
>>>>>> >
>>>>>> >
>>>>>> > http://uva.onlinejudge.org/**index.php?option=com_**
>>>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>>>> >
>>>>>> > In fact, if you look at the statistics list I am the 5th
>>>>>> fastest.
>>>>>> >
>>>>>> >http://uva.onlinejudge.org/**index.php?option=com_**
>>>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**category=
>>>>>>
>>>>>> >
>>>>>> > So -- who can beat me?
>>>>>> >
>>>>>> > --
>>>>>> > Isaac Traxler -- personal e-mail
>>>>>> > ______________________________**_________________
>>>>>> > Icpc-practice mailing list
>>>>>> > Icpc-
>>>>>> > http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>> ______________________________**_________________
>>>>>> Icpc-practice mailing list
>>>>>> Icpc-
>>>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>
>>
>> _______________________________________________
>> Icpc-practice mailing list
>> Icpc-
>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>
>>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>


X

Isaac Traxler <> wrote:

>Okay -- I got a challenge for y'all:
>
>I have solved the problem 10823: Of Circles and Squares
>
>
>http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>
>In fact, if you look at the statistics list I am the 5th fastest.
>
>http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>
>So -- who can beat me?
>
>--
>Isaac Traxler -- personal e-mail
>_______________________________________________
>Icpc-practice mailing list
>Icpc-
>http://isaac.lsu.edu/mailman/listinfo/icpc-practice
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
I hate how when I submit the same code to UVA, I get a run time of 0.008
the first time, and 0.012 the second time =\

On Tue, Aug 7, 2012 at 4:30 AM, Kelly <> wrote:

> X
>
> Isaac Traxler <> wrote:
>
> >Okay -- I got a challenge for y'all:
> >
> >I have solved the problem 10823: Of Circles and Squares
> >
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >
> >In fact, if you look at the statistics list I am the 5th fastest.
> >
> >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
> >
> >So -- who can beat me?
> >
> >--
> >Isaac Traxler -- personal e-mail
> >_______________________________________________
> >Icpc-practice mailing list
> >Icpc-
> >http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>


Run the same code on your system multiple times, with it in varying
levels of use. You will very rarely get 2 exactly equal timings,
especially over such short periods of time. It also doesn't help that
UVA seems to round their timings off to the nearest .002 or .004, so
an actual difference of .001 could make the displayed time change from
.008 to .012.

Andrew

On Fri, Aug 10, 2012 at 11:56 AM, Matthew Gavin <> wrote:
> I hate how when I submit the same code to UVA, I get a run time of 0.008 the
> first time, and 0.012 the second time =\
>
>
> On Tue, Aug 7, 2012 at 4:30 AM, Kelly <> wrote:
>>
>> X
>>
>> Isaac Traxler <> wrote:
>>
>> >Okay -- I got a challenge for y'all:
>> >
>> >I have solved the problem 10823: Of Circles and Squares
>> >
>> >
>>
>> > >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>> >
>> >In fact, if you look at the statistics list I am the 5th fastest.
>> >
>>
>> > >http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>> >
>> >So -- who can beat me?
>> >
>> >--
>> >Isaac Traxler -- personal e-mail
>> >_______________________________________________
>> >Icpc-practice mailing list
>> >Icpc-
>> >http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>> _______________________________________________
>> Icpc-practice mailing list
>> Icpc-
>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>
>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
All right, I'm not sure how to optimize the printf that outputs the answers
to the rank1 solution to Of Circles and Squares... so if someone finds a
way and beats 0.008, I'd be curious as to what you did :)

The code is in this thread [ ofcands.c ]

On Fri, Aug 10, 2012 at 12:04 PM, Andrew Stewart
<>wrote:

> Run the same code on your system multiple times, with it in varying
> levels of use. You will very rarely get 2 exactly equal timings,
> especially over such short periods of time. It also doesn't help that
> UVA seems to round their timings off to the nearest .002 or .004, so
> an actual difference of .001 could make the displayed time change from
> .008 to .012.
>
> Andrew
>
> On Fri, Aug 10, 2012 at 11:56 AM, Matthew Gavin <>
> wrote:
> > I hate how when I submit the same code to UVA, I get a run time of 0.008
> the
> > first time, and 0.012 the second time =\
> >
> >
> > On Tue, Aug 7, 2012 at 4:30 AM, Kelly <> wrote:
> >>
> >> X
> >>
> >> Isaac Traxler <> wrote:
> >>
> >> >Okay -- I got a challenge for y'all:
> >> >
> >> >I have solved the problem 10823: Of Circles and Squares
> >> >
> >> >
> >>
> >> > >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
> >> >
> >> >In fact, if you look at the statistics list I am the 5th fastest.
> >> >
> >>
> >> > >
> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
> >> >
> >> >So -- who can beat me?
> >> >
> >> >--
> >> >Isaac Traxler -- personal e-mail
> >> >_______________________________________________
> >> >Icpc-practice mailing list
> >> >Icpc-
> >> >http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> >> _______________________________________________
> >> Icpc-practice mailing list
> >> Icpc-
> >> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> >
> >
> >
> > _______________________________________________
> > Icpc-practice mailing list
> > Icpc-
> > http://isaac.lsu.edu/mailman/listinfo/icpc-practice
> >
>


It may not be rounding. I suspect they use virtual instances for judging
and that may be as accurate as they can get.

On the other hand, they may have tested and noticed that runtime often
varied by 0.001 regularly and decided to to use .002 increments to reduce
noise.

As to output, something like this might be better:

char buff[255];



buff[0]='(';
# for ease assume numbers are one digit each
buf[1]=R+'0';
buf[2]=',';
buf[3]=' ';
buf[4]=G+'0';
buf[5]=',';
buf[6]=' ';
buf[7]=B+'0';
buf[8]=')';
buf[9]='\n';
buf[10]=0;
fwrite(buff, sizeof(char), 10, stdout)

puts(buff);

This should save time -- the catch is the numbers are not one digit. You
would probably need to use itoa or write a function.

We know the numbers are in the range of 0 to 255.

int myItoA(int num, char *buff[])
{ /* FUNCTION myItoA */
int lngth;

if (10 > num)
{ /* 0-9 */
buff[0]=num+'0';
buff[1]=0;
lntgh=2;
} /* 0-9 */
else
if (100 > num)
{ /* 10 to 99 */
buff[0]=num / 10+'0';
buff[1]=num % 10 + '0';
buff[2]=0;
lngth=3;
} /* 10 to 99 */
else
{ /* 100 to 255 */
buff[0]=num / 100+'0';
buff[1]=num /10 % 10 + '0';
buff[2]=num % 10 + '0';
buff[3]=0;
lngth=4;
} /* 100 to 255 */
return lnght;
} /* FUNCTION myItoA */

buf[0]='(';
offset=myItoA(R, &buf[1]);
buf[offset++] = ',';
buf[offset++] = ' ';
offset=offset + myItoA(G, &buf[offset]);
buf[offset++] = ',';
buf[offset++] = ' ';
offset=offset + myItoA(B, &buf[offset]);
buf[offset++] = ')';
buf[offset++] = '\n';
buf[offset] = 0;
puts(buf);

Is this faster than a printf? Have to try it...


--
Isaac Traxler AIX,Linux Admin
Louisiana State University
High Performance Computing 225-578-1923
LONI AIX Clusters
AIX, Linux Support

On Fri, 10 Aug 2012, Andrew Stewart wrote:

> Date: Fri, 10 Aug 2012 17:04:56 +0000
> From: Andrew Stewart <>
> To: Matthew Gavin <>
> Cc: icpc-, Kelly <>
> Subject: Re: [Icpc-practice] challenge
>
> Run the same code on your system multiple times, with it in varying
> levels of use. You will very rarely get 2 exactly equal timings,
> especially over such short periods of time. It also doesn't help that
> UVA seems to round their timings off to the nearest .002 or .004, so
> an actual difference of .001 could make the displayed time change from
> .008 to .012.
>
> Andrew
>
> On Fri, Aug 10, 2012 at 11:56 AM, Matthew Gavin <> wrote:
>> I hate how when I submit the same code to UVA, I get a run time of 0.008 the
>> first time, and 0.012 the second time =\
>>
>>
>> On Tue, Aug 7, 2012 at 4:30 AM, Kelly <> wrote:
>>>
>>> X
>>>
>>> Isaac Traxler <> wrote:
>>>
>>>> Okay -- I got a challenge for y'all:
>>>>
>>>> I have solved the problem 10823: Of Circles and Squares
>>>>
>>>>
>>>
>>>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>>>>
>>>> In fact, if you look at the statistics list I am the 5th fastest.
>>>>
>>>
>>>>> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>>>>
>>>> So -- who can beat me?
>>>>
>>>> --
>>>> Isaac Traxler -- personal e-mail
>>>> _______________________________________________
>>>> Icpc-practice mailing list
>>>> Icpc-
>>>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>> _______________________________________________
>>> Icpc-practice mailing list
>>> Icpc-
>>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>
>>
>>
>> _______________________________________________
>> Icpc-practice mailing list
>> Icpc-
>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>
> _______________________________________________
> Icpc-practice mailing list
> Icpc-
> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>
>
_______________________________________________
Icpc-practice mailing list
Icpc-
http://isaac.lsu.edu/mailman/listinfo/icpc-practice
)
I incorporated your function into my code, but the runtime is the same:

code:
https://raw.github.com/mgavin/acm-code/master/ofcands.c

My Submissions
# Problem Verdict
Language Run Time Submission Date
1046094210823 Of Circles and Squares Accepted ANSI C
0.008 2012-08-10 19:29:58


> On Fri, Aug 10, 2012 at 1:37 PM, Isaac W Traxler <> wrote:
>>
>> It may not be rounding. I suspect they use virtual instances for judging
and that may be as accurate as they can get.
>>
>> On the other hand, they may have tested and noticed that runtime often
varied by 0.001 regularly and decided to to use .002 increments to reduce
noise.
>>
>> As to output, something like this might be better:
>>
>> char buff[255];
>>
>>
>>
>> buff[0]='(';
>> # for ease assume numbers are one digit each
>> buf[1]=R+'0';
>> buf[2]=',';
>> buf[3]=' ';
>> buf[4]=G+'0';
>> buf[5]=',';
>> buf[6]=' ';
>> buf[7]=B+'0';
>> buf[8]=')';
>> buf[9]='\n';
>> buf[10]=0;
>> fwrite(buff, sizeof(char), 10, stdout)
>>
>> puts(buff);
>>
>> This should save time -- the catch is the numbers are not one digit. You
would probably need to use itoa or write a function.
>>
>> We know the numbers are in the range of 0 to 255.
>>
>> int myItoA(int num, char *buff[])
>> { /* FUNCTION myItoA */
>> int lngth;
>>
>> if (10 > num)
>> { /* 0-9 */
>> buff[0]=num+'0';
>> buff[1]=0;
>> lntgh=2;
>> } /* 0-9 */
>> else
>> if (100 > num)
>> { /* 10 to 99 */
>> buff[0]=num / 10+'0';
>> buff[1]=num % 10 + '0';
>> buff[2]=0;
>> lngth=3;
>> } /* 10 to 99 */
>> else
>> { /* 100 to 255 */
>> buff[0]=num / 100+'0';
>> buff[1]=num /10 % 10 + '0';
>> buff[2]=num % 10 + '0';
>> buff[3]=0;
>> lngth=4;
>> } /* 100 to 255 */
>> return lnght;
>> } /* FUNCTION myItoA */
>>
>> buf[0]='(';
>> offset=myItoA(R, &buf[1]);
>> buf[offset++] = ',';
>> buf[offset++] = ' ';
>> offset=offset + myItoA(G, &buf[offset]);
>> buf[offset++] = ',';
>> buf[offset++] = ' ';
>> offset=offset + myItoA(B, &buf[offset]);
>> buf[offset++] = ')';
>> buf[offset++] = '\n';
>> buf[offset] = 0;
>> puts(buf);
>>
>> Is this faster than a printf? Have to try it...
>>
>>
>>
>> --
>> Isaac Traxler AIX,Linux Admin
>> Louisiana State University
>> High Performance Computing 225-578-1923
>> LONI AIX Clusters
>> AIX, Linux Support
>>
>> On Fri, 10 Aug 2012, Andrew Stewart wrote:
>>
>>> Date: Fri, 10 Aug 2012 17:04:56 +0000
>>> From: Andrew Stewart <>
>>> To: Matthew Gavin <>
>>> Cc: icpc-, Kelly <>
>>> Subject: Re: [Icpc-practice] challenge
>>>
>>>
>>> Run the same code on your system multiple times, with it in varying
>>> levels of use. You will very rarely get 2 exactly equal timings,
>>> especially over such short periods of time. It also doesn't help that
>>> UVA seems to round their timings off to the nearest .002 or .004, so
>>> an actual difference of .001 could make the displayed time change from
>>> .008 to .012.
>>>
>>> Andrew
>>>
>>> On Fri, Aug 10, 2012 at 11:56 AM, Matthew Gavin <>
wrote:
>>>>
>>>> I hate how when I submit the same code to UVA, I get a run time of
0.008 the
>>>> first time, and 0.012 the second time =\
>>>>
>>>>
>>>> On Tue, Aug 7, 2012 at 4:30 AM, Kelly <> wrote:
>>>>>
>>>>>
>>>>> X
>>>>>
>>>>> Isaac Traxler <> wrote:
>>>>>
>>>>>> Okay -- I got a challenge for y'all:
>>>>>>
>>>>>> I have solved the problem 10823: Of Circles and Squares
>>>>>>
>>>>>>
>>>>>
>>>>>>>
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1764
>>>>>>
>>>>>>
>>>>>> In fact, if you look at the statistics list I am the 5th fastest.
>>>>>>
>>>>>
>>>>>>>
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=problem_stats&problemid=1764&category=
>>>>>>
>>>>>>
>>>>>> So -- who can beat me?
>>>>>>
>>>>>> --
>>>>>> Isaac Traxler -- personal e-mail
>>>>>> _______________________________________________
>>>>>> Icpc-practice mailing list
>>>>>> Icpc-
>>>>>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>>>>
>>>>> _______________________________________________
>>>>> Icpc-practice mailing list
>>>>> Icpc-
>>>>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Icpc-practice mailing list
>>>> Icpc-
>>>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>>>
>>> _______________________________________________
>>> Icpc-practice mailing list
>>> Icpc-
>>> http://isaac.lsu.edu/mailman/listinfo/icpc-practice
>>>
>>>


https://raw.github.com/mgavin/acm-code/master/ofcands.c

Tried... still the same :\

On Fri, Aug 10, 2012 at 2:52 PM, Isaac W Traxler <> wrote:

> It may need some tweaking to be alittle better.
>
> Did you try puts and fwrite?
>
> It is also possible that there is not enough output to matter (lots more
> input than output). We should put together a large data file so that we can
> test a comparable runtime locally.
>
>
> --
> Isaac Traxler AIX,Linux Admin
> Louisiana State University
> High Performance Computing 225-578-1923
> LONI AIX Clusters
> AIX, Linux Support
>
> On Fri, 10 Aug 2012, Matthew Gavin wrote:
>
> Date: Fri, 10 Aug 2012 19:33:37 +0000
>> From: Matthew Gavin <>
>> To: Isaac Traxler <>
>> Subject: Re: [Icpc-practice] challenge
>>
>>
>> I incorporated your function into my code, but the runtime is the same:
>>
>> code:
>> https://raw.github.com/mgavin/**acm-code/master/ofcands.c
>>
>> My Submissions
>> # Problem Verdict
>> Language Run Time Submission Date
>> 1046094210823 Of Circles and Squares Accepted ANSI C
>> 0.008 2012-08-10 19:29:58
>>
>>
>> On Fri, Aug 10, 2012 at 1:37 PM, Isaac W Traxler <> wrote:
>>
>>>
>>> It may not be rounding. I suspect they use virtual instances for judging
>>> and that may be as accurate as they can get.
>>>
>>> On the other hand, they may have tested and noticed that runtime often
>>> varied by 0.001 regularly and decided to to use .002 increments to reduce
>>> noise.
>>>
>>> As to output, something like this might be better:
>>>
>>> char buff[255];
>>>
>>>
>>>
>>> buff[0]='(';
>>> # for ease assume numbers are one digit each
>>> buf[1]=R+'0';
>>> buf[2]=',';
>>> buf[3]=' ';
>>> buf[4]=G+'0';
>>> buf[5]=',';
>>> buf[6]=' ';
>>> buf[7]=B+'0';
>>> buf[8]=')';
>>> buf[9]='\n';
>>> buf[10]=0;
>>> fwrite(buff, sizeof(char), 10, stdout)
>>>
>>> puts(buff);
>>>
>>> This should save time -- the catch is the numbers are not one digit. You
>>> would probably need to use itoa or write a function.
>>>
>>> We know the numbers are in the range of 0 to 255.
>>>
>>> int myItoA(int num, char *buff[])
>>> { /* FUNCTION myItoA */
>>> int lngth;
>>>
>>> if (10 > num)
>>> { /* 0-9 */
>>> buff[0]=num+'0';
>>> buff[1]=0;
>>> lntgh=2;
>>> } /* 0-9 */
>>> else
>>> if (100 > num)
>>> { /* 10 to 99 */
>>> buff[0]=num / 10+'0';
>>> buff[1]=num % 10 + '0';
>>> buff[2]=0;
>>> lngth=3;
>>> } /* 10 to 99 */
>>> else
>>> { /* 100 to 255 */
>>> buff[0]=num / 100+'0';
>>> buff[1]=num /10 % 10 + '0';
>>> buff[2]=num % 10 + '0';
>>> buff[3]=0;
>>> lngth=4;
>>> } /* 100 to 255 */
>>> return lnght;
>>> } /* FUNCTION myItoA */
>>>
>>> buf[0]='(';
>>> offset=myItoA(R, &buf[1]);
>>> buf[offset++] = ',';
>>> buf[offset++] = ' ';
>>> offset=offset + myItoA(G, &buf[offset]);
>>> buf[offset++] = ',';
>>> buf[offset++] = ' ';
>>> offset=offset + myItoA(B, &buf[offset]);
>>> buf[offset++] = ')';
>>> buf[offset++] = '\n';
>>> buf[offset] = 0;
>>> puts(buf);
>>>
>>> Is this faster than a printf? Have to try it...
>>>
>>>
>>>
>>> --
>>> Isaac Traxler AIX,Linux Admin
>>> Louisiana State University
>>> High Performance Computing 225-578-1923
>>> LONI AIX Clusters
>>> AIX, Linux Support
>>>
>>> On Fri, 10 Aug 2012, Andrew Stewart wrote:
>>>
>>> Date: Fri, 10 Aug 2012 17:04:56 +0000
>>>> From: Andrew Stewart <>
>>>> To: Matthew Gavin <>
>>>> Cc: icpc-, Kelly <>
>>>> Subject: Re: [Icpc-practice] challenge
>>>>
>>>>
>>>> Run the same code on your system multiple times, with it in varying
>>>> levels of use. You will very rarely get 2 exactly equal timings,
>>>> especially over such short periods of time. It also doesn't help that
>>>> UVA seems to round their timings off to the nearest .002 or .004, so
>>>> an actual difference of .001 could make the displayed time change from
>>>> .008 to .012.
>>>>
>>>> Andrew
>>>>
>>>> On Fri, Aug 10, 2012 at 11:56 AM, Matthew Gavin <>
>>>> wrote:
>>>>
>>>>>
>>>>> I hate how when I submit the same code to UVA, I get a run time of
>>>>> 0.008 the
>>>>> first time, and 0.012 the second time =\
>>>>>
>>>>>
>>>>> On Tue, Aug 7, 2012 at 4:30 AM, Kelly <> wrote:
>>>>>
>>>>>>
>>>>>>
>>>>>> X
>>>>>>
>>>>>> Isaac Traxler <> wrote:
>>>>>>
>>>>>> Okay -- I got a challenge for y'all:
>>>>>>>
>>>>>>> I have solved the problem 10823: Of Circles and Squares
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> http://uva.onlinejudge.org/**index.php?option=com_**
>>>>>>>> onlinejudge&Itemid=8&page=**show_problem&problem=1764
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> In fact, if you look at the statistics list I am the 5th fastest.
>>>>>>>
>>>>>>>
>>>>>> http://uva.onlinejudge.org/**index.php?option=com_**
>>>>>>>> onlinejudge&Itemid=8&page=**problem_stats&problemid=1764&**
>>>>>>>> category=
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> So -- who can beat me?
>>>>>>>
>>>>>>> --
>>>>>>> Isaac Traxler -- personal e-mail
>>>>>>> ______________________________**_________________
>>>>>>> Icpc-practice mailing list
>>>>>>> Icpc-
>>>>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>>>
>>>>>>
>>>>>> ______________________________**_________________
>>>>>> Icpc-practice mailing list
>>>>>> Icpc-
>>>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ______________________________**_________________
>>>>> Icpc-practice mailing list
>>>>> Icpc-
>>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>>
>>>>> ______________________________**_________________
>>>> Icpc-practice mailing list
>>>> Icpc-
>>>> http://isaac.lsu.edu/mailman/**listinfo/icpc-practice
>>>>
>>>>
>>>>
>>
>>







NewsArc Lists  |  Culture Pages   |  Computing Archive  |  Media-Pages
Link to this page on your blog or website by copying the HTML code below and pasting it into your site: