# 23. 考勤信息

23

const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

function check(records) {
    let absent = 0;
    for(let i=0; i<recors.length; i++) {
        if (record[i] === 'absent') {
            absent++;
            if (absent > 1) {
                return false;
            }
        }
        else if (records[i] === 'late' || records[i] === 'leaveearly') {
            if (i > 0 && (records[i-1] === 'late' || records[i-1] === 'leaveearly')) {
                return false;
            }
        }
        if (i >= 6) {
            let count = 0;
            for(let j=i-6;j<=i;j++) {
                if (records[j] !== 'present') {
                    count++;
                }
            }
            if (count > 3) {
                return false;
            }
        }
    }
    return true;
}

let lineCount = 0;
let n = 0;
rl.on('line', function(line) {
    if (lineCount === 0) {
        n = parseInt(line);
    } else {
        const records = line.split(' ');
        console.log(check(records) ? 'true' : 'false');
    }
    lineCount++;
})

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47