Small factorial challenge impossible with JavaScript

While doing the challenge and looking through the tutorial I’ve noticed that this problem is doomed to be insolvable in some (at least one - javascript) coding languages due to the severely narrow time limit of around 0.2 seconds.

I’ve followed the tutorial as well as I could, this is my code together with another approach using BigInt, which also failed, due to it not being defined (maybe there are some dependencies missing)

importPackage(java.io);
importPackage(java.lang);
 
let reader = new BufferedReader( new InputStreamReader(System['in']) );


let t = parseInt(reader.read());

/*for (let i = 0; i<t; i++){
    let v = parseInt(reader.read());
    let res = 1;
    let arr = [];
    arr.push(res);
    for (let i = 2; i<=v; i++){
        let temp = 0; 
        let index;
        for (let j = 0; j<arr.length; j++){
            let x = arr[j]*i + temp; //120
            temp = Math.floor(x/10); //12
            arr[j] = x%10;          //0
            index++;
        }
        while(temp>0){
            arr.push(0);
            arr[index] = temp%10;
            temp=Math.floor(temp/10);
            index++;
        }
        
        
        
    }
    print(arr.reverse.join(""))
}*/

for (let i = 0; i<t; i++){
    let v = parseInt(reader.read());
    let res = BigInt(1);
    for (let i = 2; i<=v; i++){
      res*= BigInt(i);
    }
    print(process.version);
}

Interestingly, I’m not the only JS coder here that has run into this problem - when looking at the JS submissions for this challenge - there hasn’t been a single person yet to have passed this challenge with JS.

Therefore, dear problem hoster, if you happen to read this, please edit the time limit to at least 0.5 seconds, as this lacks fairness to some degree. Or take JavaScript out of the list of supported languages for this challenge, that would be okay as well, but I personally find it disappointing to sit hours in front of a challenge like this, trying everything and not succeeding because it’s not possible.

https://www.codechef.com/viewsolution/70197703

I used BigInteger instead of Bigint which is not available in rhino. Precompute the factorials and just query it.

Okay, seems like I’m wrong then, thank you for your reply! learned something new