제출 #37926

#제출 시각아이디문제언어결과실행 시간메모리
37926TalantUFO (IZhO14_ufo)C++11
35 / 100
2000 ms9708 KiB
#include <bits/stdc++.h>

#define fr first
#define sc second
#define OK puts("OK");
#define pb push_back
#define mk make_pair

using namespace std;

typedef long long ll;

const int inf = (int)1e9 + 7;
const int N = (int)1e6 + 7;

int n,m,r,k,p;
int mx = 0;

int main () {
        cin >> n >> m >> r >> k >> p;

        int a[n + 1][m + 1];

        for (int i = 1; i <= n; i ++)
                for (int j = 1; j <= m; j ++)
                        cin >> a[i][j];

        while (k --) {
                char ch;
                int l,bl,cnt = 0;
                cin >> ch;
                scanf ("%d%d", &l,&bl);

                if (ch == 'N') {
                        cnt = 0;
                        for (int i = 1; i <= n; i ++) {
                                if (a[i][l] >= bl)
                                        a[i][l] --,cnt ++;
                                if (cnt == r)
                                        break;
                        }
                }
                else if (ch == 'W') {
                        cnt = 0;
                        for (int i = 1; i <= m; i ++) {
                                if (a[l][i] >= bl)
                                        a[l][i] --,cnt ++;
                                if (cnt == r)
                                        break;
                        }
                }
                else if (ch == 'E') {
                        cnt = 0;
                        for (int i = m; i >= 1; i --) {
                                if (a[l][i] >= bl)
                                        a[l][i] --,cnt ++;
                                if (cnt == r)
                                        break;
                        }
                }
                else {
                        cnt = 0;
                        for (int i = n; i >= 1; i --) {
                                if (a[i][l] >= bl)
                                        a[i][l] --,cnt ++;
                                if (cnt == r)
                                        break;
                        }
                }
        }

        for (int i = 1; i <= n; i ++)
                for (int j = 2; j <= m; j ++)
                        a[i][j] += a[i][j - 1];

        for (int i = 2; i <= n; i ++)
                for (int j = 1; j <= m; j ++)
                        a[i][j] += a[i - 1][j];

        for (int i = 1; i <= n; i ++)
                a[i][0] = 0;
        for (int j = 0; j <= m; j ++)
                a[0][j] = 0;

        for (int i = p; i <= n; i ++)
                for (int j = p; j <= m; j ++) {
                        mx = max(mx,a[i][j] - a[i - p][j] - a[i][j - p] + a[i - p][j - p]);
                }

        cout << mx << endl;
}

컴파일 시 표준 에러 (stderr) 메시지

ufo.cpp: In function 'int main()':
ufo.cpp:32:39: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
                 scanf ("%d%d", &l,&bl);
                                       ^
#Verdict Execution timeMemoryGrader output
Fetching results...