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 | 3843 |
2 | jiangly | 3705 |
3 | Benq | 3628 |
4 | orzdevinwang | 3571 |
5 | Geothermal | 3569 |
5 | cnnfls_csy | 3569 |
7 | jqdai0815 | 3530 |
8 | ecnerwala | 3499 |
9 | gyh20 | 3447 |
10 | Rebelz | 3409 |
# | User | Contrib. |
---|---|---|
1 | maomao90 | 171 |
2 | awoo | 163 |
3 | adamant | 162 |
4 | TheScrasse | 158 |
5 | nor | 153 |
5 | maroonrk | 153 |
7 | -is-this-fft- | 152 |
8 | Petr | 146 |
9 | orz | 145 |
10 | pajenegod | 144 |
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.