3352021-10-14 19:21:35TachiSivatagcpp11Runtime error 0/40437ms9312 KiB
#include <bits/stdc++.h>
using namespace std;

int desert[501][501];

int main() {
  ios::sync_with_stdio(false);
  int n, m, k, e;
  cin >> n >> m >> k >> e;
  for (int i = 0; i < e; i++){
    int bax, bay, jfx, jfy;
    cin >> bax >> bay >> jfx >> jfy;
    desert[bax][bay]++;
    desert[bax][jfy+1]--;
    desert[jfx+1][bay]--;
    desert[jfx+1][jfy+1]++;
  }
  for (int i = 1; i <= n; i++){
    for (int j = 1; j <= m; j++){
      desert[i][j] += desert[i][j-1] + desert[i-1][j] - desert[i-1][j-1];
    }
  }
  cout << "\n";
  for (int i = 1; i <= n; i++){
    for (int j = 1; j <= m; j++){
      desert[i][j] += desert[i][j-1] + desert[i-1][j] - desert[i-1][j-1];
    }
  }
  int max = -1, sorszi, sorszj;
  for (int i = 3; i <= n; i++){
    for (int j = 3; j <= m; j++){
      if (max < desert[i][j] + desert[i-k][j-k] - desert[i][j-k] - desert[i-k][j]){
        max = desert[i][j] + desert[i-k][j-k] - desert[i][j-k] - desert[i-k][j];
        sorszi = i - k + 1;
        sorszj = j - k + 1;
      }
    }
  }
  cout << max << "\n" << sorszi << " " << sorszj;
  return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/40
1Accepted0/02ms1964 KiB
2Runtime error0/010ms4292 KiB
3Wrong answer0/22ms2660 KiB
4Wrong answer0/23ms3336 KiB
5Wrong answer0/24ms4220 KiB
6Wrong answer0/24ms4224 KiB
7Wrong answer0/24ms4224 KiB
8Wrong answer0/24ms4228 KiB
9Wrong answer0/22ms2776 KiB
10Wrong answer0/22ms3520 KiB
11Wrong answer0/24ms4396 KiB
12Wrong answer0/24ms4464 KiB
13Wrong answer0/24ms4468 KiB
14Wrong answer0/24ms4468 KiB
15Wrong answer0/141ms4988 KiB
16Wrong answer0/148ms6864 KiB
17Runtime error0/17ms7656 KiB
18Runtime error0/19ms8020 KiB
19Runtime error0/24ms8256 KiB
20Wrong answer0/210ms8696 KiB
21Runtime error0/214ms8760 KiB
22Runtime error0/23ms8872 KiB
23Wrong answer0/214ms9312 KiB
24Time limit exceeded0/2437ms7596 KiB