Hi Friends,
Anyone know if there is a plugin somewhere for C++ so I dont have to write all the boiler plate iostream code? Or is writing Cin apart of the contest?
Ty :3
Hi Friends,
Anyone know if there is a plugin somewhere for C++ so I dont have to write all the boiler plate iostream code? Or is writing Cin apart of the contest?
Ty :3
| # | User | Rating |
|---|---|---|
| 1 | Benq | 3676 |
| 2 | jiangly | 3670 |
| 3 | Kevin114514 | 3657 |
| 4 | maroonrk | 3355 |
| 5 | Um_nik | 3353 |
| 6 | squareOf105 | 3346 |
| 7 | tourist | 3343 |
| 8 | strapple | 3324 |
| 9 | heuristica | 3322 |
| 10 | jiangbowen | 3291 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 158 |
| 2 | nik_exists | 150 |
| 2 | maspy | 150 |
| 4 | AmShZ | 143 |
| 5 | Um_nik | 141 |
| 6 | Errichto | 139 |
| 7 | adamant | 137 |
| 8 | BledDest | 133 |
| 8 | maroonrk | 133 |
| 10 | qwexd | 130 |
| Name |
|---|



Looking at your code, I think the main issue is just that you're doing input in a weird way. Usually, people just use cin for everything.
For example, look at one of my solution's inputs compared to yours.
Mine: http://codeforces.me/contest/1011/submission/40786335
Yours: http://codeforces.me/contest/1011/submission/40792933
You kinda write input like you're using Python.
Thanks for the reply Chili.
I write in that style too (Using CIN). But sometimes when the input is too large, CIN doesnt work, and I have to use getline().
In today's contest, I think I spent over 50% of time getting my IO to work. It was the most frustrating thing ever. Hopefully I can speed it up next time... Sigh...
I've almost never had issues with cin being too slow, assuming you have sync_with_stdio stuff. The only times I ever need get_line are when I seriously need the entire line, and not just one word/number.
Could you give an example of a problem where you had issues just directly using cin?
Hey Chilli,
I am working on the marathon this week. These are my submissions http://codeforces.me/contest/1014/my
For this submission, CIN didn't work for me. I think because the input was too long, 100 000 chars in total in 1 line. http://codeforces.me/contest/1014/submission/40719388
So I changed it to getline() here and it worked. http://codeforces.me/contest/1014/submission/40757115
I can't view those submissions since marathon is an ongoing contest.
DELETE
it's ongoing contest, don't discuss
Always add this at the beginning of
main:I personally use this when competing. This makes I/O a lot faster.
I will. Any reasons why?
Thanks Ivan.
It was kind of hard for me to figure out what was going wrong with your submission before, but I doubt it was related to cin; you don't usually get runtime errors from stuff like that.
As for why you should use the things above, cin/cout by default synchronize their buffers with scanf/printf. This makes them a lot slower. The first one is the most important, the second is often just tossed in there, and I don't actually use the third line.