3472021-10-23 11:16:35somaSivatagcpp11Time limit exceeded 0/40493ms7832 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, m, k, e;
    cin >> n >> m >> k >> e;
    vector<vector<int>> v(m+1, vector<int>(n+1));
    for(int i=0;i<e;i++){
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        for(int j=m-d+1;j<=m-b+1;j++){
            for(int l=a;l<=c;l++){
                v[j][l]++;
            }
        }
    }
    for(int i=1;i<=m;i++){
        for(int j=1;j<=n;j++){
            v[i][j] += v[i-1][j] + v[i][j-1] - v[i-1][j-1];
        }
    }
    int legn = 0;
    int xkor = 0;
    int ykor = 0;
    for(int i=k;i<=m;i++){
        for(int j=k;j<=n;j++){
            if(v[i][j] - v[i][j-3] - v[i-3][j] + v[i-3][j-3] > legn){
                legn = v[i][j] - v[i][j-3] - v[i-3][j] + v[i-3][j-3];
                xkor = j;
                ykor = i;
            }
        }
    }
    cout << legn << endl;
    cout << xkor - k + 1 << ' ' << m - ykor + 1;
    return 0;
}
/*
5 6 3 4
2 2 3 4
1 1 2 4
2 3 2 3
5 5 5 6

5 6 3 4
2 2 3 4
1 1 2 4
2 3 2 3
5 5 5 6
*/
SubtaskSumTestVerdictTimeMemory
base0/40
1Accepted0/02ms1736 KiB
2Time limit exceeded0/0493ms2484 KiB
3Wrong answer0/21ms2388 KiB
4Wrong answer0/22ms2856 KiB
5Wrong answer0/28ms4244 KiB
6Wrong answer0/27ms4356 KiB
7Wrong answer0/24ms4248 KiB
8Wrong answer0/26ms4360 KiB
9Wrong answer0/21ms2412 KiB
10Wrong answer0/23ms2884 KiB
11Wrong answer0/26ms4368 KiB
12Wrong answer0/26ms4284 KiB
13Wrong answer0/26ms4384 KiB
14Wrong answer0/24ms4388 KiB
15Time limit exceeded0/1409ms2596 KiB
16Time limit exceeded0/1405ms3368 KiB
17Time limit exceeded0/1453ms4280 KiB
18Time limit exceeded0/1421ms4848 KiB
19Time limit exceeded0/2441ms5284 KiB
20Time limit exceeded0/2412ms5772 KiB
21Time limit exceeded0/2414ms6272 KiB
22Time limit exceeded0/2402ms6892 KiB
23Time limit exceeded0/2441ms7268 KiB
24Time limit exceeded0/2488ms7832 KiB