Submission #967407

#TimeUsernameProblemLanguageResultExecution timeMemory
967407IsamZemljište (COCI22_zemljiste)C++17
0 / 70
1 ms2512 KiB
#include<bits/stdc++.h> using namespace std; int r, s, a, b, c[501][501]; long long pref[501][501]; inline long long get_sm(int x1, int x2, int y1, int y2){ return pref[x2][y2] - pref[x1][y2] - pref[x2][y1] + pref[x1][y1]; } signed main(){ ios_base::sync_with_stdio(0), cin.tie(0); cin >> r >> s >> a >> b; for(register int i = 1; i <= r; ++i){ for(register int j = 1; j <= s; ++j){ cin >> c[i][j]; pref[i][j] = pref[i-1][j] + pref[i][j-1] - pref[i-1][j-1] + c[i][j]; } } long long ans = 1e17 + 7; for(register int x1 = 1; x1 <= r; ++x1){ for(register int y1 = 1; y1 <= s; ++y1){ for(register int x2 = x1; x2 <= r; ++x2){ for(register int y2 = y1; y2 <= s; ++y2){ long long cur = get_sm(x1, x2, y1, y2); ans = min(ans, 0ll + abs(cur - a) + abs(cur - b)); //if(cur > max(a, b)) break; } } } } cout << ans << '\n'; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:15:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   15 |  for(register int i = 1; i <= r; ++i){
      |                   ^
Main.cpp:16:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   16 |   for(register int j = 1; j <= s; ++j){
      |                    ^
Main.cpp:24:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   24 |  for(register int x1 = 1; x1 <= r; ++x1){
      |                   ^~
Main.cpp:26:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   26 |   for(register int y1 = 1; y1 <= s; ++y1){
      |                    ^~
Main.cpp:28:21: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   28 |    for(register int x2 = x1; x2 <= r; ++x2){
      |                     ^~
Main.cpp:30:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   30 |     for(register int y2 = y1; y2 <= s; ++y2){
      |                      ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...