Submission #741845

# Submission time Handle Problem Language Result Execution time Memory
741845 2023-05-15T01:48:40 Z Dulguun88 Maja (COCI18_maja) C++14
0 / 110
30 ms 17872 KB
# 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 time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 468 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 30 ms 17872 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 11 ms 4820 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -