Submission #407141

# Submission time Handle Problem Language Result Execution time Memory
407141 2021-05-18T14:48:28 Z victoriad Maxcomp (info1cup18_maxcomp) C++14
100 / 100
161 ms 8140 KB
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <utility>
#include <queue>
#include <map>   
#include <array>
#include <iomanip>
#include <fstream>
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <utility>
#include <queue>
#include <map>   
#include <array>
#include <iomanip>
#include <fstream>
#include <cstdlib>
 
using namespace std;
 
 
 int main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   int n,m;
   cin>>n>>m;
   int A[n][m];
   int memo[n][m];
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cin>>A[i][j];
		}
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			memo[i][j]=A[i][j]-1;
			if(i>0){
				memo[i][j]=max(memo[i][j],memo[i-1][j]-1);
			}
			if(j>0){
				memo[i][j]=max(memo[i][j],memo[i][j-1]-1);
			}
		}
	}
	for(int i=n-1;i>=0;i--){
		for(int j=m-1;j>=0;j--){
			if(i<n-1){
				memo[i][j]=max(memo[i][j],memo[i+1][j]-1);
			}
			if(j<m-1){
				memo[i][j]=max(memo[i][j],memo[i][j+1]-1);
			}
		}
	}
	int ans=-1;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			ans=max(ans,memo[i][j]-A[i][j]);
		}
	}
   cout<<ans;
    return 0;
 }
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 2 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 2 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 2 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 2 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 161 ms 8116 KB Output is correct
19 Correct 151 ms 8140 KB Output is correct
20 Correct 153 ms 7628 KB Output is correct
21 Correct 157 ms 8112 KB Output is correct
22 Correct 151 ms 8120 KB Output is correct
23 Correct 158 ms 8140 KB Output is correct
24 Correct 140 ms 7728 KB Output is correct