It seems that using regex heavily in java.util.Scanner causes this issue.
I ran benchmark suggested by the article on my machine, and java.util.Scanner was ~6.5x slower than java.io.BufferedReader + parseInt
Thanks for the good article; it could help me a lot.
Search found 2 matches
- Mon Aug 04, 2014 8:58 am
- Forum: Volume 1 (100-199)
- Topic: 102 - Ecological Bin Packing
- Replies: 485
- Views: 116936
- Sun Aug 03, 2014 7:53 am
- Forum: Volume 1 (100-199)
- Topic: 102 - Ecological Bin Packing
- Replies: 485
- Views: 116936
Problem 102 - Same algorithm, TLE in Java, AC in C++11
Java version: http://ideone.com/Nnr2GT
C++11 version: http://ideone.com/85ldcr
Both are almost same program (except code related to read from stdin)
However, Java version got TLE; while C++11 version got AC by 0.042sec.
Is there any reason about this?
C++11 version: http://ideone.com/85ldcr
Both are almost same program (except code related to read from stdin)
However, Java version got TLE; while C++11 version got AC by 0.042sec.
Is there any reason about this?