Problem A
https://codejam.withgoogle.com/codejam/contest/8284486/dashboard#s=p0
Summing up all : we get
          
S(n)=((r*(r-1))/2)^2-((r+c)*(r-1)*r*(2r-1))/6+(r*c*(r-1)*r)/2
      
  
   
https://codejam.withgoogle.com/codejam/contest/8284486/dashboard#s=p0
Solution : http://ideone.com/lPWmS1
Approach : 
Let no, of dots be r rows and c columns. 
For side length=1  => No. of squares = (r-1)*(c-1)
For side length=2  => No. of squares=2*(r-2)*(c-2)
     Because all axis aligned can also be diagonally arranged atmost 1 way
For side length=3  => No. of squares=3*(r-3)*(c-3)
    Because all axis aligned can also be diagonally arranged atmost 2 way
      .
      .
      .
So on till side length=min(r,c)-1
Summing up all : we get
S(n)=((r*(r-1))/2)^2-((r+c)*(r-1)*r*(2r-1))/6+(r*c*(r-1)*r)/2
     Modulo can be taken using modular inverse of 2 , 6 .
 
Awesome article, it was exceptionally helpful! I simply began in this and I'm becoming more acquainted with it better! Cheers, keep doing awesome!
ReplyDeleteSoftware Testing Services
Software Testing Company
QA Testing Services
Software Testing Companies
Functional Testing Services
Test Automation Services
Functional Testing Company
Performance Testing Services
Security Testing Services
API Testing Services
With a dedicated focus on cybersecurity, DevStringX has earned a strong reputation as a security testing company in India. Their security testing services in India offer in-depth analysis and expert recommendations to fix vulnerabilities in your software. Their service offerings are tailored to meet the needs of clients from all sectors, making them a top security testing services company.
ReplyDeleteCloveHR offers a robust employee management system tailored for modern businesses seeking agility and clarity in HR operations. Integrated with a dynamic leave management system, it manages time-off policies, tracks balances, and auto-generates leave reports. CloveHR reduces paperwork, improves communication, and ensures seamless leave and employee data coordination.
ReplyDelete