printf("\n=== FINAL LOCKED PAIRS ===\n"); for (int i = 0; i < candidate_count; i++) { for (int j = 0; j < candidate_count; j++) { if (locked[i][j]) { printf(" %s → %s\n", candidates[i], candidates[j]); } } }
// Helper function to check if adding edge creates cycle (same as original but made callable) bool creates_cycle_helper(int start, int end) { if (start == end) return true; cs50 tideman
// Identify and highlight ties printf("\n--- TIE ANALYSIS ---\n"); bool has_ties = false; for (int i = 0; i < pair_count - 1; i++) { int margin_current = preferences[pairs[i].winner][pairs[i].loser] - preferences[pairs[i].loser][pairs[i].winner]; int margin_next = preferences[pairs[i + 1].winner][pairs[i + 1].loser] - preferences[pairs[i + 1].loser][pairs[i + 1].winner]; if (margin_current == margin_next) { if (!has_ties) { printf("\n⚠️ TIES DETECTED in ranking:\n"); has_ties = true; } printf(" Ranks %i and %i have equal victory margins\n", i + 1, i + 2); } } printf("\n=== FINAL LOCKED PAIRS ===\n"); for (int i