Submission #245909

#TimeUsernameProblemLanguageResultExecution timeMemory
245909RealSuperman1Maxcomp (info1cup18_maxcomp)C++17
60 / 100
1088 ms12792 KiB
// #pragma comment(linker, "\stack:200000000") // #pragma GCC optimize("Ofast") // #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcount,abm,mmx,avx,avx2,tune=native") //#pragma GCC target("avx,avx2") // #pragma GCC target("avx,avx2,fma") // #pragma GCC optimization("O3") // #pragma GCC optimization("unroll-loops") #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <bits/stdc++.h> #define ll long long #define ld long double #define pb push_back #define fi first #define se second #define pii pair<int, int> #define pll pair<ll, ll> using namespace std; using namespace __gnu_pbds; typedef tree< ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; const int N = 1e3 + 10; const int mod = 1e9 + 7; const ll INF = 1e16; const int lim = 450; int n, m, a[N][N]; int main() { // ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL); // freopen("input.txt", "r", stdin); // freopen("input.in", "r", stdin); // freopen("input.out", "w", stdout); cin >> n >> m; for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) cin >> a[i][j]; int ans = -1; for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) for (int i1 = 1; i1 <= n; i1++) for (int j1 = 1; j1 <= m; j1++) ans = max(ans, max(a[i][j], a[i1][j1]) - min(a[i][j], a[i1][j1]) - abs(i - i1) - abs(j - j1) - 1); cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...