ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Common Board

To Admins: About the C/C++ Compiler
Posted by Seyyed Mehran Kholdi (HalfBloodCoder) 17 Sep 2008 17:29
I found an amazing fact about the compiler. My code (when compiled using c++ compiler) runs in 0.001 second, and when I compile it using C compiler runs in 0.015 second, and the use the same memory. So why should someone use the C compiler? (Also, I heard that C codes, run faster than C++ ones)
2234052    17:25:47
17 Sep 2008    Seyyed Mehran Kholdi (HalfBloodCoder)    1087    C++    Accepted
    0.001    149 KB
2234051    17:25:37
17 Sep 2008    Seyyed Mehran Kholdi (HalfBloodCoder)    1087    C    Accepted
    0.015    149 KB
Re: To Admins: About the C/C++ Compiler
Posted by Denis Koshman 17 Sep 2008 21:01
Submit it around 10 times and you'll see that execution time is different. Cache hits, concurrent compilations/tests, etc... All of this has effect. AFAIK, I even saw different memory consumption (within a few KB) for the same code submitted several times.
Re: To Admins: About the C/C++ Compiler
Posted by Seyyed Mehran Kholdi (HalfBloodCoder) 19 Sep 2008 17:46
I had many other experiences, but the same result.
even I tested it on another problems. as you can see:
2236738    17:43:35
19 Sep 2008    Seyyed Mehran Kholdi (HalfBloodCoder)    1260    C++    Accepted
    0.001    141 KB
2236737    17:43:25
19 Sep 2008    Seyyed Mehran Kholdi (HalfBloodCoder)    1260    C    Accepted
    0.015    141 KB
Again, another weakness in the C compiler. I guess the optimizer (compiler) does not work well for C