/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 142ms 13.504 MiB
#2 Wrong Answer 136ms 13.562 MiB
#3 Wrong Answer 138ms 13.504 MiB

Code

function countPerfectSquareSubgrids(H, W) {
    let count = 0;
    let maxSize = Math.min(H, W);

    for (let size = 1; size <= maxSize; size++) {
        let horizontalOptions = H - size + 1;
        let verticalOptions = W - size + 1;
        count += horizontalOptions * verticalOptions;
    }

    return count;
}

// Sample Input
const H = 5;
const W = 3;

console.log(countPerfectSquareSubgrids(H, W)); // Output: 26

Information

Submit By
Type
Submission
Problem
P1121 Square Counting Challenge
Contest
Brain Booster #7
Language
JavaScript (Node.js v18.19.1)
Submit At
2024-11-05 15:30:58
Judged At
2024-11-11 02:30:34
Judged By
Score
10
Total Time
142ms
Peak Memory
13.562 MiB