/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 121ms 13.762 MiB
#2 Wrong Answer 120ms 13.883 MiB
#3 Wrong Answer 121ms 13.551 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-05 15:30:58
Judged By
Score
10
Total Time
121ms
Peak Memory
13.883 MiB