Hello!
I have problem with this problem (:D !!) here is my submission
Thanks for your attention!
GOOD BYE !
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 150 |
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.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