see this link: https://codeforces.com/contest/1284/submission/68190516
ios_base :: sync_with_stdio(false); cin.tie(NULL);
when remove this two line it got ac.. but before wa.. why and how??
# | User | Rating |
---|---|---|
1 | tourist | 3690 |
2 | jiangly | 3647 |
3 | Benq | 3581 |
4 | orzdevinwang | 3570 |
5 | Geothermal | 3569 |
5 | cnnfls_csy | 3569 |
7 | Radewoosh | 3509 |
8 | ecnerwala | 3486 |
9 | jqdai0815 | 3474 |
10 | gyh20 | 3447 |
# | User | Contrib. |
---|---|---|
1 | maomao90 | 172 |
2 | adamant | 164 |
3 | awoo | 163 |
4 | TheScrasse | 160 |
5 | nor | 157 |
6 | maroonrk | 155 |
7 | -is-this-fft- | 152 |
8 | Petr | 146 |
9 | orz | 145 |
9 | pajenegod | 145 |
see this link: https://codeforces.com/contest/1284/submission/68190516
ios_base :: sync_with_stdio(false); cin.tie(NULL);
when remove this two line it got ac.. but before wa.. why and how??
Name |
---|
Do you need to use
iosbase
hacks?scanf
is fast enough without them.in c++ the string datatype.. is there any away to input and output with scanf and printf??
What about using
getline
?If you use
You should not use scanf/printf, cin/cout at the same time. Or you can submit code on Visual C++
cin
andcout
are synced tostdin
andstdout
by default, so that people can use both C I/O and C++ I/O at the same time. You disabled it withios_base::sync_with_stdio(false)
, so there are now two separate buffers which messes things up. This is why you don't write code which you don't understand.ios_base::sync_with_stdio(false)
disables syncing betweencin
/cout
andscanf
/printf
, andcin.tie(nullptr)
disablescout
being flushed automatically when you do stuff withcin
. They're not magic lines of code that speeds everything up.thanks!!
and i use cin.tie(0) or cout.tie(0) or both??
cout.tie(nullptr)
doesn't do anything as far as I know.