/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 125ms 13.652 MiB
#2 Wrong Answer 131ms 13.559 MiB
#3 Wrong Answer 127ms 13.59 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:31:08
Judged At
2024-11-05 15:31:08
Judged By
Score
10
Total Time
131ms
Peak Memory
13.652 MiB