Created
June 21, 2016 16:49
-
-
Save bertolo1988/8a7e8f3aef10115b4ca0b0557f1fa080 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var n = parseInt(readline()); | |
var s, skillsInput = readline().split(' '); | |
var skills = []; | |
var programmers = []; | |
var mathematicians = []; | |
var athletes = []; | |
var groups = []; | |
for (var i = 0; i < skillsInput.length; i++) { | |
var skillCursor = parseInt(skillsInput[i]); | |
switch (skillCursor) { | |
case 1: | |
programmers.push(i + 1); | |
break; | |
case 2: | |
mathematicians.push(i + 1); | |
break; | |
case 3: | |
athletes.push(i + 1); | |
break; | |
default: | |
athletes.push(i + 1); | |
break; | |
} | |
} | |
for (var j = 0; j < programmers.length && j < mathematicians.length && j < athletes.length; j++) { | |
groups.push({ programmer: programmers[j], mathematician: mathematicians[j], athlete: athletes[j] }); | |
} | |
print(groups.length); | |
for (i = 0; i < groups.length; i++) { | |
print(groups[i].programmer + " " + groups[i].mathematician + " " + groups[i].athlete); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment