Submission #66990

# Submission time Handle Problem Language Result Execution time Memory
66990 2018-08-13T07:29:52 Z tempytemptemp Maxcomp (info1cup18_maxcomp) C++14
60 / 100
29 ms 1608 KB
/*
  Let the good times roll
*/
#include	<iostream>
#include	<cstdio>
#include	<vector>
#include 	<set>
#include	<map>
#include	<queue>
#include	<stack>
#include	<algorithm>
#include	<cstring>
#include	<cfloat>
#include	<cmath>
#include	<cassert>
#include	<locale>
#include	<string>
#include	<bitset>
#include	<functional>
#include	<climits>
#include	<iomanip>
using namespace std;

#define read(x)     freopen(x,"r",stdin)
#define write(x)    freopen(x,"w",stdout)
#define cl(a,b)	    memset(a,b,sizeof(a))
#define all(x)      x.begin(),x.end()
#define rall(x)     x.rbegin(),x.rend()
#define ll          long long
#define ld          long double
#define vec         vector
#define vi          vec<int>
#define heap        priority_queue
#define res         reserve
#define pb          push_back
#define f(x,y,z)    for(int x=(y); x<(z); x++)
#define fd(x,y,z)   for(int x=(y); x>=(z); x--)
#define fit(x,y)    for(auto x: y)
#define srt(x)      sort(all(x))
#define rsrt(x)     sort(rall(x))
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
#define pii         pair<int,ll>
#define ppi         pair<pii,int>
#define pip         pair<int,pii>
#define mp          make_pair
#define f1          first
#define s2          second
#define cdbg(x)     cerr<<#x<<" = "<<x<<",\t";
#define cdbl        cerr<<"\n----------\n";
#define pow2(x)     ((x)*(x))
#define edist(x1, y1, x2, y2) (sqrt((pow2(x1-x2)+pow2(y1-y2))))
#define mdist(x1, y1, x2, y2) (abs((x1)-(x2))+abs((y1)-(y2)))
#define y1          FullSensei
#define mid         ((ss+se)>>1)
#define left        (si<<1)
#define right       ((si<<1)+1)
#define pi          3.141592653589793
#define popcount    __builtin_popcount
#define spc			' '
#define endl		'\n'
bool checkbit(int x,int y){return (x&(1<<y));}
int setbit(int x,int y){return (x^(1<<y));}
const int dirs[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int mod=1e9+7;
const int p1=805306457;
const int p2=1610612741;
const int INF=1e9;
const int N=50+7;
int a[N][N];
int n, m;

int main(){
	//read("in.in");
	cin>>n>>m;
	f(i,1,n+1){
		f(j,1,m+1){
			cin>>a[i][j];
		}
	}
	ll ans=-1;
	f(i1,1,n+1){
		f(j1,1,m+1){
			f(i2,1,n+1){
				f(j2,1,m+1){
					ll weight=abs(a[i1][j1]-a[i2][j2])-(abs(i1-i2)+abs(j1-j2)+1);
					/*if(ans<weight){
						cerr<<i1<<spc<<j1<<spc<<i2<<spc<<j2<<spc<<"weight: "<<weight<<endl;
					}*/
					ans=max(ans,weight);
				}
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 3 ms 360 KB Output is correct
3 Correct 2 ms 472 KB Output is correct
4 Correct 3 ms 592 KB Output is correct
5 Correct 3 ms 592 KB Output is correct
6 Correct 3 ms 592 KB Output is correct
7 Correct 2 ms 592 KB Output is correct
8 Correct 2 ms 592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 708 KB Output is correct
2 Correct 8 ms 724 KB Output is correct
3 Correct 8 ms 724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 3 ms 360 KB Output is correct
3 Correct 2 ms 472 KB Output is correct
4 Correct 3 ms 592 KB Output is correct
5 Correct 3 ms 592 KB Output is correct
6 Correct 3 ms 592 KB Output is correct
7 Correct 2 ms 592 KB Output is correct
8 Correct 2 ms 592 KB Output is correct
9 Correct 28 ms 756 KB Output is correct
10 Correct 21 ms 756 KB Output is correct
11 Correct 21 ms 864 KB Output is correct
12 Correct 21 ms 888 KB Output is correct
13 Correct 20 ms 888 KB Output is correct
14 Correct 21 ms 952 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 3 ms 360 KB Output is correct
3 Correct 2 ms 472 KB Output is correct
4 Correct 3 ms 592 KB Output is correct
5 Correct 3 ms 592 KB Output is correct
6 Correct 3 ms 592 KB Output is correct
7 Correct 2 ms 592 KB Output is correct
8 Correct 2 ms 592 KB Output is correct
9 Correct 7 ms 708 KB Output is correct
10 Correct 8 ms 724 KB Output is correct
11 Correct 8 ms 724 KB Output is correct
12 Correct 28 ms 756 KB Output is correct
13 Correct 21 ms 756 KB Output is correct
14 Correct 21 ms 864 KB Output is correct
15 Correct 21 ms 888 KB Output is correct
16 Correct 20 ms 888 KB Output is correct
17 Correct 21 ms 952 KB Output is correct
18 Runtime error 29 ms 1608 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Halted 0 ms 0 KB -