Submission #497020

#TimeUsernameProblemLanguageResultExecution timeMemory
497020Nuraly_SerikbayMaxcomp (info1cup18_maxcomp)C++14
15 / 100
1 ms308 KiB
#include <bits/stdc++.h> #define endl "\n" #define mp make_pair #define pb push_back #define F first #define S second #define sz size() #define rep(i,k,n) for(int i = k ; i <= n ; ++i) #define per(i,k,n) for(int i = k ; i >= n ; --i) #define Zymraq() ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0) #define all(x) x.begin(),x.end() #define fr(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout) #define toqta return 0 #define PERMUTE next_permutation #define no cout<<"No"<<endl; #define yes cout<<"Yes"<<endl; #define a() a + 1, a + n + 1 using namespace std; typedef long long ll; typedef unsigned long long ull; typedef string S; typedef double ld; typedef long double lld; const int N = 1e6 + 17; const int modd = 1e9 + 7; const ll INF = 1e18 - 19; const int P = 37; const ll NN = 1e7 + 17; const ld eps = 1e-19; const double pi = 3.141592653589793238462643383279 ; bool sortbysec(const pair<int,int> &a, const pair<int,int> &b){ return (a.second < b.second); } void pre (ll a) { cout << fixed << setprecision(a); return; } ll n, m, a[100][100], mx; void solve() { cin >> n >> m; for (int i = 1; i <= n; ++ i) { for (int j = 1; j <= m; ++ j) { cin >> a[i][j]; } } if (n == 1) { for (int i = 1; i <= m; ++ i) { for (int j = i + 1; j <= m; ++ j) { mx = max (mx, abs(a[1][i] - a[1][j]) - (j - i + 1)); } } cout << mx; return; } for (int i = 1; i <= n; ++ i) { for (int j = 1; j <= m; ++ j) { for (int k = i; k <= n; ++ k) { for (int o = j; o <= m; ++ o) { if (o == j && k == i) continue; ll pr = mx; mx = max (mx, abs(a[i][j] - a[k][o]) - (abs(i - k) + abs(j - o) + 1)); } } } } cout << mx; return; } int main() { // Zymraq (); solve(); return 0; }

Compilation message (stderr)

maxcomp.cpp: In function 'void solve()':
maxcomp.cpp:70:10: warning: unused variable 'pr' [-Wunused-variable]
   70 |       ll pr = mx;
      |          ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...