언어/C&C++ 응용

[C++] 시간 초과 해결

차가운오미자 2021. 9. 18. 16:07

cin, cout 은 시간이 많이 걸린다.

printf나 scanf를 사용하면 시간을 단축할 수 있지만, 

 

ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);

이걸 main함수 맨 앞에 쓰는 게 가장 빠르다.

'언어 > C&C++ 응용' 카테고리의 다른 글

[C++] upper_bound, lower_bound  (0) 2021.09.11
[C++] vector iterator, unique사용  (0) 2021.09.11
[C] 정렬: qsort()  (0) 2021.09.07
[C++] std::sort()  (0) 2021.09.06
[C] 특수 입력  (0) 2021.08.24