ja / en
Overview

入出力高速化

2024/07/29
1 min read

Purpose

cin/cout automatically flushes the buffer to ensure the execution order matches C-style stdio output. This disables that behavior. It also configures output precision to 16 decimal places.
To avoid writing it inside main(), we use a technique of calling it as a struct constructor:

Implementation

struct init {
init() {
cin.tie(0)->sync_with_stdio(0);
ios::sync_with_stdio(false);
cout << fixed << setprecision(16);
}
} init;