| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 17468 | AZE_XeRoX | UFO (IZhO14_ufo) | C++98 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <cmath>
#include <iomanip>
#include <algorithm>
#define intt long long int
using namespace std;
intt n , m , r , k , p ;
int main ()
{
intt h , abs , x ;
char s ;
cin >> n >> m >> r >> k >> p ;
intt a[n][m] ;
for ( intt i = 1 ; i <= n ; i ++ )
for ( intt j = 1 ; j <= m ; j ++ ) cin >> a[i][j] ;
for ( intt t = 0 ; t < k ; t ++ ) {
cin >> s >> x >> h ;
intt rr ;
rr = r ;
if ( s == 'N' )
for ( intt i = 1; i <= n; i ++ )
if ( rr && a[i][x] >= h) a[i][x] --, rr -- ;
else if ( rr != 0 ) break;
if ( s == 'W' )
for ( intt i = 1; i <= m; i ++ )
if ( rr && a[x][i] >= h ) a[x][i] --, r -- ;
else if ( rr != 0 ) break;
if ( s == 'E' )
for ( intt i = n; i >= 1; i -- )
if ( rr && a[x][i] >= h ) a[x][i] --, r -- ;
else if ( rr != 0 ) break;
if ( s == 'S' )
for ( intt i = m; i >= 1; i -- )
if ( rr && a[i][x] >= h ) a[i][x] --, r -- ;
else if (rr != 0 ) break;
}
for ( intt i = 1 ; i <= n - p + 1 ; i ++ ) {
for ( intt j = 1 ; j <= m - p + 1 ; j++) {
intt c ;
c = 0 ;
for ( intt t = i ; k < i + p ; k ++ )
for (intt q= j ; l < j + p ; l ++ )
c += a[t][q];
abs = max ( abs , c ) ;
}
}
cout << abs << endl;
return 0;
}
