Add new attachment

Only authorized users are allowed to upload new attachments.

List of attachments

Kind Attachment Name Size Version Date Modified Author Change note
cpp
main.cpp 2.9 kB 1 20-Aug-2015 17:35 filip_bujaroski Множење, Олимпијада

This page (revision-8) was last changed on 20-Aug-2015 17:35 by filip_bujaroski

This page was created on 20-Aug-2015 17:35 by bedzo

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Difference between version and

At line 246 changed one line
int n,m,pi,pj,ei,ej;
int n,m,pi,pj,ei,ej,ans=999999;
At line 248 changed one line
bool isvalid(int r,int i, int j,int ri, int rj,int c)
queue<int> qi,qj,qc,t;
void input()
At line 250 removed 11 lines
for(int k=1;k<=r;k++)
{
int ni=i+ri*k,nj=j+rj*k;
if(ni<0 || ni>=n || nj<0 || nj>=m) return false;
if(mat[ni][nj]=='#') return false;
}
return true;
}
int main()
{
At line 268 added one line
}
At line 270 added 20 lines
void output()
{
for(int i=1;i<4;i++) if(dp[ei][ej][i]!=-1) ans=min(ans,dp[ei][ej][i]);
cout<<ans<<endl;
}
bool isvalid(int r,int i, int j,int ri, int rj,int c)
{
for(int k=1;k<=r;k++)
{
int ni=i+ri*k,nj=j+rj*k;
if(ni<0 || ni>=n || nj<0 || nj>=m) return false;
if(mat[ni][nj]=='#') return false;
}
return true;
}
void bfs()
{
int i,j,k,l;
At line 280 changed one line
queue<int> qi,qj,qc,t;
At line 306 changed 3 lines
int ans=999999;
for(i=1;i<4;i++) if(dp[ei][ej][i]!=-1) ans=min(ans,dp[ei][ej][i]);
cout<<ans<<endl;
}
int main()
{
input();
bfs();
output();
At line 327 added one line
Version Date Modified Size Author Changes ... Change note
8 20-Aug-2015 17:35 9.808 kB filip_bujaroski to previous
7 20-Aug-2015 17:35 6.838 kB bedzo to previous | to last
6 20-Aug-2015 17:35 5.588 kB bedzo to previous | to last
5 20-Aug-2015 17:35 5.47 kB bedzo to previous | to last
4 20-Aug-2015 17:35 6.684 kB bedzo to previous | to last
3 20-Aug-2015 17:35 5.873 kB bedzo to previous | to last
2 20-Aug-2015 17:35 5.851 kB bedzo to previous | to last
1 20-Aug-2015 17:35 0.516 kB bedzo to last
« This page (revision-8) was last changed on 20-Aug-2015 17:35 by filip_bujaroski