Submission #76255997


Source Code Expand

function main(input) {
    let data = input.split("\n");
    let sharis = data[1].split(" ").map(x => parseInt(x));
    let netas = data[2].split(" ").map(y => parseInt(y));

    let comp = (a,b) => {return (a - b)}

    /*for(let i = 0; i < sharis.length-1; i++) {
        for(let j = 0; j  < sharis.length-1 - i; j++) {
            if (sharis[j] > sharis[j+1]) {
                const temp = sharis[j];
                sharis[j] = sharis[j+1];
                sharis[j+1] = temp;
            }
        }
    }
    for(let i = 0; i < netas.length-1; i++) {
        for(let j = 0; j  < netas.length-1 - i; j++) {
            if (netas[j] > netas[j+1]) {
                const temp = netas[j];
                netas[j] = netas[j+1];
                netas[j+1] = temp;
            }
        }
    }*/
    sharis = sharis.sort(comp);
    netas = netas.sort(comp);
    

    let counter = 0;
    while(netas.length > 0 && sharis.length > 0) {
        while(netas[netas.length-1] > sharis[sharis.length-1]*2) {
            netas.pop();
        }
        if (netas.length > 0 && sharis.length > 0) {
          netas.pop();
          sharis.pop();
          counter++;
        }
    }
    console.log(counter);

}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

Submission Info

Submission Time
Task C - Sushi
User espre
Language JavaScript (Node.js 22.19.0)
Score 300
Code Size 1307 Byte
Status AC
Exec Time 185 ms
Memory 89968 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 36
Set Name Test Cases
Sample sample00.txt, sample01.txt, sample02.txt
All sample00.txt, sample01.txt, sample02.txt, testcase00.txt, testcase01.txt, testcase02.txt, testcase03.txt, testcase04.txt, testcase05.txt, testcase06.txt, testcase07.txt, testcase08.txt, testcase09.txt, testcase10.txt, testcase11.txt, testcase12.txt, testcase13.txt, testcase14.txt, testcase15.txt, testcase16.txt, testcase17.txt, testcase18.txt, testcase19.txt, testcase20.txt, testcase21.txt, testcase22.txt, testcase23.txt, testcase24.txt, testcase25.txt, testcase26.txt, testcase27.txt, testcase28.txt, testcase29.txt, testcase30.txt, testcase31.txt, testcase32.txt
Case Name Status Exec Time Memory
sample00.txt AC 41 ms 41216 KiB
sample01.txt AC 21 ms 41208 KiB
sample02.txt AC 21 ms 41380 KiB
testcase00.txt AC 116 ms 53996 KiB
testcase01.txt AC 28 ms 48412 KiB
testcase02.txt AC 50 ms 53912 KiB
testcase03.txt AC 41 ms 51064 KiB
testcase04.txt AC 33 ms 50048 KiB
testcase05.txt AC 50 ms 53936 KiB
testcase06.txt AC 38 ms 51368 KiB
testcase07.txt AC 132 ms 74312 KiB
testcase08.txt AC 185 ms 89132 KiB
testcase09.txt AC 177 ms 82436 KiB
testcase10.txt AC 98 ms 72140 KiB
testcase11.txt AC 95 ms 71732 KiB
testcase12.txt AC 106 ms 73636 KiB
testcase13.txt AC 127 ms 84664 KiB
testcase14.txt AC 142 ms 89968 KiB
testcase15.txt AC 143 ms 82096 KiB
testcase16.txt AC 31 ms 49500 KiB
testcase17.txt AC 42 ms 51796 KiB
testcase18.txt AC 178 ms 85420 KiB
testcase19.txt AC 178 ms 81772 KiB
testcase20.txt AC 179 ms 84900 KiB
testcase21.txt AC 179 ms 84892 KiB
testcase22.txt AC 22 ms 41392 KiB
testcase23.txt AC 21 ms 41120 KiB
testcase24.txt AC 48 ms 59384 KiB
testcase25.txt AC 47 ms 59536 KiB
testcase26.txt AC 181 ms 85876 KiB
testcase27.txt AC 180 ms 82488 KiB
testcase28.txt AC 180 ms 86180 KiB
testcase29.txt AC 181 ms 85300 KiB
testcase30.txt AC 181 ms 85780 KiB
testcase31.txt AC 179 ms 85540 KiB
testcase32.txt AC 179 ms 86016 KiB