19 lines
731 B
Text
19 lines
731 B
Text
|
---
|
||
|
id: io-speed
|
||
|
title: Input / Output Speed
|
||
|
author: ?
|
||
|
description: ""
|
||
|
---
|
||
|
|
||
|
(actually figure out what makes a dif on USACO lol)
|
||
|
|
||
|
## C++
|
||
|
|
||
|
(using scanf, printf instead?)
|
||
|
|
||
|
(not using endl?)
|
||
|
|
||
|
Including `ios_base::sync_with_stdio(0); cin.tie(0);` in the main function can speed up input & output significantly on some tasks. See [here](https://codeforces.com/blog/entry/5217) and [StackOverflow](https://stackoverflow.com/questions/31162367/significance-of-ios-basesync-with-stdiofalse-cin-tienull) for more information.
|
||
|
|
||
|
- Actually, the former link says that it is supposedly prohibited to use `freopen` to redirect `cin` and `cout` if `ios_base::sync_with_stdio(0); cin.tie(0);` is included, but it works properly as far as I know.
|