CSES - Datatähti 2023 alku - Results
Submission details
Task:Lehmät
Sender:discape
Submission time:2022-11-06 21:03:53 +0200
Language:Node.js
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
Test results
testverdicttimegroup
#10.11 s1, 2details
#20.11 s1, 2details
#30.11 s1, 2details
#40.11 s1, 2details
#50.11 s1, 2details
#60.11 s2details
#70.11 s2details
#80.11 s2details
#90.11 s2details

Code

const { exit } = require("process");
const readline = require("readline");
const r = readline.createInterface({
input: process.stdin,
output: process.stdout,
terminal: false,
});
function read() {
return new Promise((res) => {
r.on("line", (line) => {
res(line);
});
});
}
return 1;
(async () => {
let [h, w] = (await read()).split(" ");
let x1,
y1,
n = 0,
x2;
yloop: for (let y = 0; y < h; y++) {
line = await read();
for (let x = 0; x < w; x++) {
const c = line[x];
if (x1 === undefined) {
if (c === "*") {
x1 = x;
y1 = y;
x2 = line.lastIndexOf("*");
continue yloop;
}
} else {
if (c === "*" && x === x1 + 1) {
console.log(n);
exit();
} else if (c === "@" && x > x1 && x < x2) {
n++;
}
}
}
}
})();

Test details

Test 1

Group: 1, 2

Verdict:

input
3 3
***
*.*
***

correct output
0

user output
(empty)

Test 2

Group: 1, 2

Verdict:

input
3 3
***
*@*
***

correct output
1

user output
(empty)

Test 3

Group: 1, 2

Verdict:

input
5 10
...@......
..******..
@.*@@@@*.@
..******..
...

correct output
4

user output
(empty)

Test 4

Group: 1, 2

Verdict:

input
10 10
@@...@.@@@
..@@.@@..@
@.*******@
..*@....*.
...

correct output
11

user output
(empty)

Test 5

Group: 1, 2

Verdict:

input
10 10
**********
*@@@@@@@@*
*@@@@@@@@*
*@@@@@@@@*
...

correct output
64

user output
(empty)

Test 6

Group: 2

Verdict:

input
100 100
.........................@.......

correct output
60

user output
(empty)

Test 7

Group: 2

Verdict:

input
100 100
..@@..........@......@....@@.....

correct output
1507

user output
(empty)

Test 8

Group: 2

Verdict:

input
100 100
.@..@@..@@.@..@..@..@@..@..@.....

correct output
3348

user output
(empty)

Test 9

Group: 2

Verdict:

input
100 100
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...

correct output
7225

user output
(empty)