Submission #1319013

#TimeUsernameProblemLanguageResultExecution timeMemory
1319013muhammad-ahmadMaxcomp (info1cup18_maxcomp)C++20
0 / 100
0 ms336 KiB
// #include <bits/stdc++.h> #include <iostream> #include <cmath> #include <algorithm> #include <map> #include <vector> #include <iomanip> #include <string> #include <queue> #include <set> #include <deque> #include <numeric> #include <stack> #include <chrono> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; void fast_io() { // freopen("", "r", stdin); // freopen("", "w", stdout); ios::sync_with_stdio(0); cin.tie(); cout.tie(); cout << setprecision(9); } #define int long long #define endl '\n' #define all(v) (v).begin(), (v).end() #define rall(v) (v).rbegin(), (v).rend() #define fi first #define se second #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> void solve() { int n, m; cin >> n >> m; int a[n + 1][m + 1]; for (int i = 1; i <= n; i++){ for (int j = 1; j <= m; j++){ cin >> a[i][j]; } } int ans = -1e18; for (int x = 1; x <= n; x++){ for (int y = 1; y <= n; y++){ for (int i = 1; i <= n; i++){ for (int j = 1; j <= m; j++){ ans = max(ans, a[x][y] - a[i][j] - abs(i - x) - abs(j - y) - 1); } } } } cout << max(0ll, ans) << endl; } signed main() { fast_io(); srand(chrono::steady_clock::now().time_since_epoch().count()); int tc = 1; // cin >> tc; while (tc--) solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...