Submission #741845

#TimeUsernameProblemLanguageResultExecution timeMemory
741845Dulguun88Maja (COCI18_maja)C++14
0 / 110
30 ms17872 KiB
# include<bits/stdc++.h> using namespace std; struct T{ int x,y; }; T mov[4]={{0,1},{1,0},{-1,0},{0,-1}}; int main(){ int n,m,a,b,c,mx=0; cin>>n>>m>>a>>b>>c; vector<vector<int>>v(n+2,vector<int>(m+2,-1000)); for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ cin>>v[i][j]; } } queue<T>q; q.push({a,b}); c=c/2; while(!q.empty()){ if(c>0){ if(c==1){ T aa=q.front(); q.pop(); for(auto a:mov){ v[aa.x+a.x][aa.y+a.y]=v[aa.x+a.x][aa.y+a.y]+v[aa.x][aa.y]; mx=max(mx,v[aa.x+a.x][aa.y+a.y]); q.push({aa.x+a.x,aa.y+a.y}); } } else{ T aa=q.front(); q.pop(); for(auto a:mov){ v[aa.x+a.x][aa.y+a.y]=v[aa.x+a.x][aa.y+a.y]*2+v[aa.x][aa.y]; q.push({aa.x+a.x+aa.y+a.y}); mx=max(mx,v[aa.x+a.x][aa.y+a.y]); } } } else{ cout<<mx; return 0 ; } c--; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...