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 | 3676 |
| 2 | Kevin114514 | 3659 |
| 3 | jiangly | 3640 |
| 4 | turmax | 3450 |
| 5 | tourist | 3382 |
| 6 | strapple | 3360 |
| 7 | Um_nik | 3354 |
| 8 | squareOf105 | 3348 |
| 9 | maroonrk | 3312 |
| 10 | idontwannadothis…e | 3191 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 155 |
| 2 | nik_exists | 151 |
| 3 | maspy | 149 |
| 4 | AmShZ | 145 |
| 5 | Um_nik | 143 |
| 6 | Errichto | 139 |
| 7 | BledDest | 136 |
| 8 | adamant | 134 |
| 9 | maroonrk | 132 |
| 10 | cry | 130 |
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