function initializeCompetition(teamID) {
const team = validateTeam(teamID);
const problems = loadProblemSet();
const session = {
team: team,
problems: problems,
startTime: new Date(),
submissions: [],
score: 0
};
return session;
}
class CompetitionManager {
constructor() {
this.teams = [];
this.leaderboard = [];
this.timeLimit = 4 * 60 * 60 * 1000;
}
registerTeam(team) {
const validatedTeam = {
...team,
registeredAt: new Date(),
status: "registered"
};
this.teams.push(validatedTeam);
}
startCompetition() {
return this.teams.map(team => this.initializeSession(team));
}
submitSolution(teamID, problemID, solution) {
const team = this.teams.find(t => t.id === teamID);
if (!team) return { error: "Team not found" };
const result = this.evaluateSolution(solution, problemID);
team.submissions.push({
problemID,
solution,
result,
timestamp: new Date()
});
this.updateScore(team, result);
return result;
}
}
const judgeSystem = {
testCases: new Map(),
runTests(solution, problemID) {
const tests = this.testCases.get(problemID);
let passed = 0;
for (const test of tests) {
try {
const output = solution(test.input);
if (output === test.expected) passed++;
} catch (error) {
console.log("Runtime error:", error);
}
}
return {
passed,
total: tests.length,
score: (passed / tests.length) * 100
};
}
};
function initializeCompetition(teamID) {
const team = validateTeam(teamID);
const problems = loadProblemSet();
const session = {
team: team,
problems: problems,
startTime: new Date(),
submissions: [],
score: 0
};
return session;
}
class CompetitionManager {
constructor() {
this.teams = [];
this.leaderboard = [];
this.timeLimit = 4 * 60 * 60 * 1000;
}
registerTeam(team) {
const validatedTeam = {
...team,
registeredAt: new Date(),
status: "registered"
};
this.teams.push(validatedTeam);
}
startCompetition() {
return this.teams.map(team => this.initializeSession(team));
}
submitSolution(teamID, problemID, solution) {
const team = this.teams.find(t => t.id === teamID);
if (!team) return { error: "Team not found" };
const result = this.evaluateSolution(solution, problemID);
team.submissions.push({
problemID,
solution,
result,
timestamp: new Date()
});
this.updateScore(team, result);
return result;
}
}
const judgeSystem = {
testCases: new Map(),
runTests(solution, problemID) {
const tests = this.testCases.get(problemID);
let passed = 0;
for (const test of tests) {
try {
const output = solution(test.input);
if (output === test.expected) passed++;
} catch (error) {
console.log("Runtime error:", error);
}
}
return {
passed,
total: tests.length,
score: (passed / tests.length) * 100
};
}
};
function initializeCompetition(teamID) {
const team = validateTeam(teamID);
const problems = loadProblemSet();
const session = {
team: team,
problems: problems,
startTime: new Date(),
submissions: [],
score: 0
};
return session;
}
class CompetitionManager {
constructor() {
this.teams = [];
this.leaderboard = [];
this.timeLimit = 4 * 60 * 60 * 1000;
}
registerTeam(team) {
const validatedTeam = {
...team,
registeredAt: new Date(),
status: "registered"
};
this.teams.push(validatedTeam);
}
startCompetition() {
return this.teams.map(team => this.initializeSession(team));
}
submitSolution(teamID, problemID, solution) {
const team = this.teams.find(t => t.id === teamID);
if (!team) return { error: "Team not found" };
const result = this.evaluateSolution(solution, problemID);
team.submissions.push({
problemID,
solution,
result,
timestamp: new Date()
});
this.updateScore(team, result);
return result;
}
}
const judgeSystem = {
testCases: new Map(),
runTests(solution, problemID) {
const tests = this.testCases.get(problemID);
let passed = 0;
for (const test of tests) {
try {
const output = solution(test.input);
if (output === test.expected) passed++;
} catch (error) {
console.log("Runtime error:", error);
}
}
return {
passed,
total: tests.length,
score: (passed / tests.length) * 100
};
}
};
function initializeCompetition(teamID) {
const team = validateTeam(teamID);
const problems = loadProblemSet();
const session = {
team: team,
problems: problems,
startTime: new Date(),
submissions: [],
score: 0
};
return session;
}
class CompetitionManager {
constructor() {
this.teams = [];
this.leaderboard = [];
this.timeLimit = 4 * 60 * 60 * 1000;
}
registerTeam(team) {
const validatedTeam = {
...team,
registeredAt: new Date(),
status: "registered"
};
this.teams.push(validatedTeam);
}
startCompetition() {
return this.teams.map(team => this.initializeSession(team));
}
submitSolution(teamID, problemID, solution) {
const team = this.teams.find(t => t.id === teamID);
if (!team) return { error: "Team not found" };
const result = this.evaluateSolution(solution, problemID);
team.submissions.push({
problemID,
solution,
result,
timestamp: new Date()
});
this.updateScore(team, result);
return result;
}
}
const judgeSystem = {
testCases: new Map(),
runTests(solution, problemID) {
const tests = this.testCases.get(problemID);
let passed = 0;
for (const test of tests) {
try {
const output = solution(test.input);
if (output === test.expected) passed++;
} catch (error) {
console.log("Runtime error:", error);
}
}
return {
passed,
total: tests.length,
score: (passed / tests.length) * 100
};
}
};
function initializeCompetition(teamID) {
const team = validateTeam(teamID);
const problems = loadProblemSet();
const session = {
team: team,
problems: problems,
startTime: new Date(),
submissions: [],
score: 0
};
return session;
}
class CompetitionManager {
constructor() {
this.teams = [];
this.leaderboard = [];
this.timeLimit = 4 * 60 * 60 * 1000;
}
registerTeam(team) {
const validatedTeam = {
...team,
registeredAt: new Date(),
status: "registered"
};
this.teams.push(validatedTeam);
}
startCompetition() {
return this.teams.map(team => this.initializeSession(team));
}
submitSolution(teamID, problemID, solution) {
const team = this.teams.find(t => t.id === teamID);
if (!team) return { error: "Team not found" };
const result = this.evaluateSolution(solution, problemID);
team.submissions.push({
problemID,
solution,
result,
timestamp: new Date()
});
this.updateScore(team, result);
return result;
}
}
const judgeSystem = {
testCases: new Map(),
runTests(solution, problemID) {
const tests = this.testCases.get(problemID);
let passed = 0;
for (const test of tests) {
try {
const output = solution(test.input);
if (output === test.expected) passed++;
} catch (error) {
console.log("Runtime error:", error);
}
}
return {
passed,
total: tests.length,
score: (passed / tests.length) * 100
};
}
};
function initializeCompetition(teamID) {
const team = validateTeam(teamID);
const problems = loadProblemSet();
const session = {
team: team,
problems: problems,
startTime: new Date(),
submissions: [],
score: 0
};
return session;
}
class CompetitionManager {
constructor() {
this.teams = [];
this.leaderboard = [];
this.timeLimit = 4 * 60 * 60 * 1000;
}
registerTeam(team) {
const validatedTeam = {
...team,
registeredAt: new Date(),
status: "registered"
};
this.teams.push(validatedTeam);
}
startCompetition() {
return this.teams.map(team => this.initializeSession(team));
}
submitSolution(teamID, problemID, solution) {
const team = this.teams.find(t => t.id === teamID);
if (!team) return { error: "Team not found" };
const result = this.evaluateSolution(solution, problemID);
team.submissions.push({
problemID,
solution,
result,
timestamp: new Date()
});
this.updateScore(team, result);
return result;
}
}
const judgeSystem = {
testCases: new Map(),
runTests(solution, problemID) {
const tests = this.testCases.get(problemID);
let passed = 0;
for (const test of tests) {
try {
const output = solution(test.input);
if (output === test.expected) passed++;
} catch (error) {
console.log("Runtime error:", error);
}
}
return {
passed,
total: tests.length,
score: (passed / tests.length) * 100
};
}
};