답안 #337613

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
337613 2020-12-21T09:11:02 Z kutbilim_one UFO (IZhO14_ufo) C++14
컴파일 오류
0 ms 0 KB
/** kutbilim.one **/
#include <bits/stdc++.h>

using namespace std;

#define all(x) x.begin(),x.end()
#define int long long
#define endl '\n'
                                   /*
ifstream in("test.txt"); 
#define cin in                   */

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n, m, r, k, p;
    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 side;
		int pos, h;
		cin >> side >> pos >> h;

		int shots = r;
		if(side == 'W'){
			for(int j = 1; j <= m && shots > 0; j++)
				if(a[pos][j] >= h) a[pos][j]--, shots--;
		}else if(side == 'E'){
		    for(int j = m; j >= 1 && shots > 0; j--)
				if(a[pos][j] >= h) a[pos][j]--, shots--;
		}else if(side == 'N'){
		    for(int i = 1; i <= n && shots > 0; i++)
				if(a[i][pos] >= h) a[i][pos]--, shots--;
		}else{
		    for(int i = n; i >= 1 && shots > 0; i--)
				if(a[i][pos] >= h) a[i][pos]--, shots--;
		}
	}

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

	int maxx = 0;
	for(int i = 1; i <= m; i++){
		for(int j = 1; j <= n; j++){
        	sums[j][i] += sums[j-1][i];
        	maxx = max(maxx, sums[i][j]-sums[i][j-p]-sums[i-p][j]+sums[i-p][j-p]);
        }
	}                
	    
    cout << maxx;

    return 0;
}

Compilation message

ufo.cpp: In function 'int main()':
ufo.cpp:21:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   21 |     for(int i = 1; i <= n; i++)
      |     ^~~
ufo.cpp:25:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   25 |  while(k--){
      |  ^~~~~
during RTL pass: expand
ufo.cpp:20:26: internal compiler error: in make_decl_rtl, at varasm.c:1340
   20 |     int a[n+1][m+1] = {{}};
      |                          ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-9/README.Bugs> for instructions.