Hello!
I have problem with this problem (:D !!) here is my submission
Thanks for your attention!
GOOD BYE !
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
Hello!
I have problem with this problem (:D !!) here is my submission
Thanks for your attention!
GOOD BYE !
Название |
---|
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.net/contest/456/submission/9666030 (826 ms)
Scanf/printf: http://codeforces.net/contest/456/submission/9665953 (358 ms)
Oh. I don't know... I read this link:
http://codeforces.net/blog/entry/5217