Hello!
I have problem with this problem (:D !!) here is my submission
Thanks for your attention!
GOOD BYE !
# | User | Rating |
---|---|---|
1 | tourist | 3993 |
2 | jiangly | 3743 |
3 | orzdevinwang | 3707 |
4 | Radewoosh | 3627 |
5 | jqdai0815 | 3620 |
6 | Benq | 3564 |
7 | Kevin114514 | 3443 |
8 | ksun48 | 3434 |
9 | Rewinding | 3397 |
10 | Um_nik | 3396 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 155 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
10 | nor | 152 |
Hello!
I have problem with this problem (:D !!) here is my submission
Thanks for your attention!
GOOD BYE !
Name |
---|
Try changing from cin to scanf. It's a pretty big input, so maybe the issue lies there.
UPDATE: Indeed, changing to scanf gets it AC.
Thanks a lot ! I got AC :)
And as a side note, I saw in your code that you do
(int)ceil( L[parV] / 2.0 )
, when you could have simply done(L[parV] + 1) / 2
. Without loss of generality, whenever you want to doceil(a/b)
, it's more convenient to code(a+b-1)/b
.I know this has nothing to do with your original question, I just wanted to comment that.
Another way is
(a/b) + (a%b!=0)
which is equivalent and never results in overflow.I think you mean
(a/b) + (a%b!=0)
.Yeah you're right oops.
cin.tie(0) might also help. I actually thought that it would be almost as fast as scanf but doesnt seem to be the case and it is not enough to get AC. However, endl is very slow and with cin.tie(0) and '\n' you can also get AC. With scanf and '\n' or printf it is even faster.
Is there some difference between ios_base::sync_with_stdio(0) and ios::sync_with_stdio(0)?
In g++, cin.tie(0) + ios::sync_with_stdio(0) + not using endl is faster than scanf/printf.
I don't think you can use endl in printf.
Cin.tie(0) + ios_base::sync_with_stdio(0) + '\n': http://codeforces.me/contest/456/submission/9666030 (826 ms)
Scanf/printf: http://codeforces.me/contest/456/submission/9665953 (358 ms)
Oh. I don't know... I read this link:
http://codeforces.me/blog/entry/5217