|
|
Show all threads Hide all threads Show all messages Hide all messages | Can't understand the problem | Skeef79 | 1855. Trade Guilds of Erathia | 12 Sep 2019 13:51 | 3 | How is it possible?? Establish 2 4 = 2.6667? 1 2 3 4 1 2 2 (2+2)/2 = 2 I don't understand what you mean there. In fact, the problem asks for an interval [l, r] to find the average cost of a sub-interval. That is, as for the first test case. After two 'change' queries we have cost(1, 2) = 1; cost(2, 3) = 2, cost(3, 4) = 2. Then we are asked for the average on the interval [2, 4] which is (cost(2, 3) + cost(3, 4) + cost(2, 4)) / 3. So, given an interval [l, r] you are asked to compute: int64_t n_of_intervals = 0; int64_t total_sum = 0; for (int i = l; i < r; ++i) for (int j = i + 1; j <= r; ++j) n_of_intervals += 1 total_sum += cost(i, j) output total_sum / n_of_intervals | WA2 | Михаил | 1855. Trade Guilds of Erathia | 3 Mar 2019 00:15 | 1 | WA2 Михаил 3 Mar 2019 00:15 | WA6 | Zearot | 1855. Trade Guilds of Erathia | 15 Sep 2016 12:46 | 2 | WA6 Zearot 29 Aug 2014 15:43 I used segment tree to solve it and got WA6. What's special about test 6? Thanks. Always remember to use long long! please notice that a*b maybe exceed INT_MAX! I have wa 6 and change this to ac! | Problem with problem | LSBG | 1855. Trade Guilds of Erathia | 28 Sep 2011 11:53 | 2 | I would really appreciate if somebody can help me a bit with the solution of this problem, because I was trying really hard to solve it and couldn't come up with good enough solution. If you do not want to post here please share your ideas via email on bstrandjev [ et ] gmail. |
|
|
|