제출 #1143031

#제출 시각아이디문제언어결과실행 시간메모리
1143031tkm_algorithmsMaxcomp (info1cup18_maxcomp)C++20
0 / 100
1100 ms213060 KiB
/** * In the name of Allah * We are nothing and you're everything * author: najmuddin **/ #include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native") using namespace std; #define all(x) begin(x), end(x) #define sz(x) (int)(x).size() typedef long long ll; #define int ll const char nl = '\n'; const int N = 1e8+5; //const int inf = 1e18; const int mod = 1e9+7; void solve() { int ans = -1; int n, m; cin >> n >> m; vector<vector<int>> a(n, vector<int> (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) { for (int x = 0; x < n; ++x) { for (int y = 0; y < m; ++y) { ans = max(ans, a[i][j]-a[x][y]-abs(x-i)-abs(y-j)-1); //if (ans == 3)cout << i << ' ' << j << ' ' << x << ' ' << y << nl; } } } } cout << ans; } int32_t main() { ios::sync_with_stdio(0); cin.tie(0); int t = 1; cin >> t; while (t--) { 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...