Submission #2407460
Source Code Expand
var lines: string[] = []; var reader: any = require("readline").createInterface({ input: process.stdin, output: process.stdout }); reader.on("line", function(line: string) { lines.push(line); }); reader.on("close", function() { var blueCardsNum: number = Number(lines[0]); var earnMap: { [key: string]: number } = {}; for (var i = 1; i < blueCardsNum + 1; i++) { if (earnMap[lines[i]]) { earnMap[lines[i]] = earnMap[lines[i]] + 1; } else { earnMap[lines[i]] = 1; } } for (var i = blueCardsNum + 2; i < lines.length; i++) { if (earnMap[lines[i]]) { earnMap[lines[i]] = earnMap[lines[i]] - 1; } else { earnMap[lines[i]] = -1; } } var maxKey: string = Object.keys(earnMap).reduce( (prev: string, current: string): string => { return earnMap[current] > earnMap[prev] ? current : prev; } ); console.log(earnMap[maxKey] < 0 ? 0 : earnMap[maxKey]); });
Submission Info
Submission Time | |
---|---|
Task | B - Two Colors Card Game |
User | RIT80 |
Language | TypeScript (2.1.6) |
Score | 200 |
Code Size | 974 Byte |
Status | AC |
Exec Time | 60 ms |
Memory | 7628 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | example_0, example_1, example_2, example_3 |
All | example_0, example_1, example_2, example_3, rand_0, rand_1, rand_2, rand_3, rand_4, rand_5, rand_6 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
example_0 | AC | 60 ms | 7500 KB |
example_1 | AC | 60 ms | 7500 KB |
example_2 | AC | 59 ms | 7628 KB |
example_3 | AC | 59 ms | 7500 KB |
rand_0 | AC | 60 ms | 7628 KB |
rand_1 | AC | 60 ms | 7628 KB |
rand_2 | AC | 60 ms | 7628 KB |
rand_3 | AC | 59 ms | 7500 KB |
rand_4 | AC | 60 ms | 7628 KB |
rand_5 | AC | 60 ms | 7628 KB |
rand_6 | AC | 59 ms | 7628 KB |