CSES - Datatähti 2023 alku - Results
Submission details
Task:Lehmät
Sender:Hervanta
Submission time:2022-11-01 02:08:24 +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 { readSync } = require('fs');
const { Buffer } = require('buffer');

function readInput() {
  let buffer = Buffer.alloc(1000, 10);
  for(i=0; i<1000; i++) {
    if(!readSync(0, buffer, i, 1) || buffer[i]===10) {
      return buffer.toString("utf8").split("\n")[0];
    }
  }
}

input = input2.split("\n")

let cowCount = 0
const re = /\*+[@\.]+\*+/
input = readInput()
for (let i = 0; i < input.length; i++) {
    if (input[i].match(re)) {
        cowCount += input[i].match(re)[0].split("@").length - 1   
    }
}

console.log(cowCount)

Test details

Test 1

Group: 1, 2

Verdict:

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

correct output
0

user output
(empty)

Error:
/box/input/code.js:13
input = input2.split("\n")
^

ReferenceError: input2 is not defined...

Test 2

Group: 1, 2

Verdict:

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

correct output
1

user output
(empty)

Error:
/box/input/code.js:13
input = input2.split("\n")
^

ReferenceError: input2 is not defined...

Test 3

Group: 1, 2

Verdict:

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

correct output
4

user output
(empty)

Error:
/box/input/code.js:13
input = input2.split("\n")
^

ReferenceError: input2 is not defined...

Test 4

Group: 1, 2

Verdict:

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

correct output
11

user output
(empty)

Error:
/box/input/code.js:13
input = input2.split("\n")
^

ReferenceError: input2 is not defined...

Test 5

Group: 1, 2

Verdict:

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

correct output
64

user output
(empty)

Error:
/box/input/code.js:13
input = input2.split("\n")
^

ReferenceError: input2 is not defined...

Test 6

Group: 2

Verdict:

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

correct output
60

user output
(empty)

Error:
/box/input/code.js:13
input = input2.split("\n")
^

ReferenceError: input2 is not defined...

Test 7

Group: 2

Verdict:

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

correct output
1507

user output
(empty)

Error:
/box/input/code.js:13
input = input2.split("\n")
^

ReferenceError: input2 is not defined...

Test 8

Group: 2

Verdict:

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

correct output
3348

user output
(empty)

Error:
/box/input/code.js:13
input = input2.split("\n")
^

ReferenceError: input2 is not defined...

Test 9

Group: 2

Verdict:

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

correct output
7225

user output
(empty)

Error:
/box/input/code.js:13
input = input2.split("\n")
^

ReferenceError: input2 is not defined...