답안 #17459

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
17459 2015-12-13T17:10:37 Z azecoder UFO (IZhO14_ufo) C++
20 / 100
2000 ms 9704 KB
#include <iostream>
#include <algorithm>

#define f first
#define s second
 
using namespace std;
 
int n , m , R , k , p , x, h, ans ;

char ch ;
 
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] ;
    
    for ( int l = 0 ; l < k ; l ++ ) {
    	
        cin >> ch >> x >> h ;
        
		int r = R ;
		
        if ( ch == 'N' ) for ( int i = 1; i <= n; i ++ )
			if ( r && a[i][x] >= h) a[i][x] --, r -- ;
            else if ( !r ) break;
            
        if ( ch == 'W' ) for ( int i = 1; i <= m; i ++ )
			if ( r && a[x][i] >= h ) a[x][i] --, r -- ;
            else if ( !r ) break;
            
        if ( ch == 'E' ) for ( int i = n; i >= 1; i -- )
			if ( r && a[x][i] >= h ) a[x][i] --, r -- ;
    		else if ( !r ) break;
    		
        if ( ch == 'S' ) for ( int i = m; i >= 1; i -- )
			if ( r && a[i][x] >= h ) a[i][x] --, r -- ;
        	else if (!r) break;
        	
    }
    
    for ( int i = 1 ; i <= n - p + 1 ; i ++ ) {
        
		for ( int j = 1 ; j <= m - p + 1 ; j++) {
            
			int c = 0;
            
			for ( int k = i ; k < i + p ; k ++ )
                for ( int l = j ; l < j + p ; l ++ )
                    c += a[k][l];
      
	        ans = max ( ans , c ) ;
      
	    }
        
    }
    
    cout << ans << endl;
 
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2016 KB Output is correct
2 Incorrect 0 ms 2016 KB Output isn't correct
3 Runtime error 0 ms 2016 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Correct 9 ms 2016 KB Output is correct
5 Runtime error 13 ms 2108 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Correct 209 ms 3812 KB Output is correct
7 Runtime error 333 ms 6188 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 173 ms 6184 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 179 ms 5996 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 186 ms 6192 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 189 ms 6108 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 193 ms 6192 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Execution timed out 2000 ms 6188 KB Execution timed out
14 Runtime error 186 ms 6112 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 223 ms 6184 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 186 ms 6108 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Execution timed out 2000 ms 6188 KB Execution timed out
18 Execution timed out 2000 ms 5640 KB Execution timed out
19 Runtime error 183 ms 6580 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Correct 353 ms 9704 KB Output is correct