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

Discussion of Problem 1004. Sightseeing Trip

Golang 1.3: Extremely Slow fmt.Scanf
Posted by Linh Tran Tuan 20 May 2016 21:26
!!Please be aware of fmt.Scanf poor performance!!

I did everything to test it on Timus and feel so sorry for it. My code logic is ok except this! It took a day to figure out.

I got AC with FreePascal before, and now Golang. So my advice is: read all input first using bufio and ioutil like this:

input = bufio.NewReader(os.Stdin)
output = bufio.NewWriter(os.Stdout)

_wholeText, _ := ioutil.ReadAll(input)
numbers := strings.Fields(string(_wholeText))