A/c cho e hỏi trong các kì thi về thuật toán mà yêu cầu đọc ghi file input output thì nên dùng
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
Hay
ifstream cin("input.txt");
ofstream cout("output.txt")
Với lại có cần thêm 2 dòng này không:
ios_base::sync_with_stdio(false);
cin.tie(nullptr);