All the students involved in a suspected cheating case will be referred to the study director. This can lead to a referral to the Disciplinary Committee of Uppsala University. A conviction there can lead to the exclusion from all teaching, examination, and university facilities for up to six months. The instructor will wait for the verdict of that committee before deciding whether to declare a solution invalid or have it graded, and this decision is independent of that verdict.
It is acceptable to discuss solutions and solution methods with others, but one must have constructed oneself (or within a group, where permitted) the submitted solution. If you think there is a risk that such a discussion leads to very similar solutions, then report this to the instructor in advance. This may result in extra exercises, if the instructor estimates that the cooperation was too close, but it is not considered cheating.
Automated solution comparison methods may be used to detect suspected cheating cases.