function findChampions(statistics) {
const participantStats = new Map();
statistics.forEach((day) => {
console.log(day);
day.forEach(participant => {
participantStats.set(participant.userId, {
days:
} )
})
})
}
 
 
 
// Пример 1:
 
const statistics1 = [
[{ userId: 1, steps: 1000 }, { userId: 2, steps: 1500 }],
[{ userId: 2, steps: 1000 }]
];
 
 
console.log(findChampions(statistics1)); // { userIds: [2], steps: 2500 }
 
 
 
// Пример 2:
 
const statistics2 = [
[{ userId: 1, steps: 2000 }, { userId: 2, steps: 1500 }],
[{ userId: 1, steps: 3500 }]
];
 
 
 
console.log(findChampions(statistics2)); // { userIds: [1], steps: 5500 }
 
 
 
// Пример 3:
 
const statistics3 = [
[{ userId: 1, steps: 1000 }, { userId: 2, steps: 1000 }],
[{ userId: 1, steps: 1000 }, { userId: 2, steps: 1000 }]
];
 
 
 
console.log(findChampions(statistics3)); // { userIds: [1, 2], steps: 2000 }
 
 
 
// Пример 4:
 
const statistics4 = [
[{ userId: 1, steps: 1000 }, { userId: 2, steps: 1000 }, { userId: 3, steps: 1000 }, { userId: 4, steps: 1000 }, { userId: 5, steps: 1000 }],
[{ userId: 1, steps: 2000 }, { userId: 2, steps: 2000 }, { userId: 3, steps: 1500 }, { userId: 4, steps: 1500 }, { userId: 5, steps: 2000 }],
[{ userId: 1, steps: 1500 }, { userId: 2, steps: 1500 }, { userId: 3, steps: 2000 }, { userId: 4, steps: 2000 }, { userId: 5, steps: 1500 }],
[{ userId: 1, steps: 1000 }, { userId: 2, steps: 1000 }, { userId: 3, steps: 1500 }, { userId: 4, steps: 1500 }, { userId: 5, steps: 1000 }],
[{ userId: 1, steps: 3000 }, { userId: 2, steps: 3000 }, { userId: 3, steps: 2000 }, { userId: 4, steps: 2000 }, { userId: 5, steps: 3000 }]
];
 
 
console.log(findChampions(statistics4)); // { userIds: [1, 2, 5], steps: 8500 }
 
// Пример 5:
 
const statistics5 = [
[{ userId: 1, steps: 1000 }, { userId: 2, steps: 1500 }],
[{ userId: 1, steps: 2000 }, { userId: 2, steps: 1000 }, { userId: 3, steps: 1800 }],
[{ userId: 1, steps: 1500 }, { userId: 2, steps: 1500 }, { userId: 4, steps: 1000 }],
[{ userId: 1, steps: 1000 }, { userId: 2, steps: 2000 }, { userId: 3, steps: 1200 }],
[{ userId: 1, steps: 3000 }, { userId: 2, steps: 1000 }, { userId: 4, steps: 2000 }]
];
 
 
 
console.log(findChampions(statistics5)); // { userIds: [1], steps: 8500 }
Code will run automatically after changes.
Code runs in an isolated environment.