Hi, can someone give me some hints about this problem? Thanks!

http://www.z-training.net/tasks.php?show_task=5000000584

http://www.z-training.net/tasks.php?show_task=5000000584

# | User | Rating |
---|---|---|

1 | tourist | 3707 |

2 | Benq | 3672 |

3 | Radewoosh | 3655 |

4 | ksun48 | 3547 |

5 | jiangly | 3492 |

6 | Miracle03 | 3480 |

7 | ecnerwala | 3400 |

8 | maroonrk | 3385 |

9 | peehs_moorhsum | 3384 |

10 | sunset | 3338 |

# | User | Contrib. |
---|---|---|

1 | 1-gon | 214 |

2 | Um_nik | 191 |

3 | sus | 183 |

4 | Errichto | 180 |

5 | awoo | 179 |

6 | tourist | 178 |

7 | -is-this-fft- | 172 |

8 | Radewoosh | 171 |

9 | maroonrk | 169 |

9 | Ashishgup | 169 |

Hi, can someone give me some hints about this problem? Thanks!

http://www.z-training.net/tasks.php?show_task=5000000584

http://www.z-training.net/tasks.php?show_task=5000000584

↑

↓

Codeforces (c) Copyright 2010-2021 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Sep/18/2021 05:55:26 (j1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|

Thanks for your reply. However, I don't really understand your algorithm, so I tested it on the example below. Please tell me if I misunderstood you anywhere.

Suppose the edges given are 1, 1, 2, 3, 4, 5. There are 6 edges, which meansand sqrt(2 * 6) = 3 (I am assuming you take the floor of the number), and 3 * (3 + 1) = 12 = 2 * 6. Therefore, there is a possibility of a valid output. Then, you multiply the x smallest elements together. In this case, it is 1 * 1 * 2 = 2. Since 1 + 1 + 2 is not equal to 5, it does not make a valid output, and therefore you output -1.

However, the answer is actually 1 * 1 * 3. One possible configuration of the points is (0,1,2,5).

Did I misunderstand you somewhere?