Checker comment "wrong answer Test 226: Expected -1, got a Tree !! (test case 226)" I have checked the -1 condition in the beginning
if(m<n || m>n*(n+1ll)/2ll)
{
cout<<"-1\n";
return;
}
| # | User | Rating |
|---|---|---|
| 1 | Benq | 3792 |
| 2 | VivaciousAubergine | 3647 |
| 3 | jiangly | 3631 |
| 4 | Kevin114514 | 3574 |
| 5 | maroonrk | 3521 |
| 6 | strapple | 3515 |
| 7 | Radewoosh | 3461 |
| 8 | tourist | 3428 |
| 9 | turmax | 3378 |
| 10 | Um_nik | 3376 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 162 |
| 2 | adamant | 148 |
| 3 | Um_nik | 146 |
| 4 | Dominater069 | 143 |
| 5 | errorgorn | 140 |
| 6 | cry | 138 |
| 7 | Proof_by_QED | 136 |
| 8 | YuukiS | 135 |
| 9 | chromate00 | 134 |
| 10 | soullless | 133 |
Checker comment "wrong answer Test 226: Expected -1, got a Tree !! (test case 226)" I have checked the -1 condition in the beginning
if(m<n || m>n*(n+1ll)/2ll)
{
cout<<"-1\n";
return;
}
| Name |
|---|



Hey man your code trips up on the one node cas when n=1 you still fall into the make edges logic and end up printing a false edge like 1 1 so the judge thinkse you handed it a tree instead of just a single node
to fix this slam in an early check if n == 1 then if m == 1 print 1 and return else print -1 and return and only run your normal tree building code when n > 1.
Thank you. Missed a tricky edge case.
happens to the best of us man