제출 #512659

#제출 시각아이디문제언어결과실행 시간메모리
512659lovro_nidogon1삶의 질 (IOI10_quality)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include<quality.h> #define breturn return using namespace std; int mat[3001][3001], r, c, h, w; int sus[3001][3001], lo = 0, hi = 1e9, mid, exsus[3001][3001]; bool fun() { for(int i = 0; i < r; i++) for(int j = 0; j < c; j++) { if(mat[i][j] > mid) sus[i][j] = -1; else if(mat[i][j] < mid) sus[i][j] = 1; else sus[i][j] = 0; } for(int i = 0; i < r; i++) for(int j = 0; j < c; j++) { exsus[i][j] = sus[i][j]; if(i and j) exsus[i][j] += exsus[i - 1][j] + exsus[i][j - 1] - exsus[i - 1][j - 1]; else if(i) exsus[i][j] += exsus[i - 1][j]; else if(j) exsus[i][j] += exsus[i][j - 1]; } for(int i = h - 1; i < r; i++) for(int j = w - 1; j < c; j++) { int sum = exsus[i][j]; if(i - h >= 0 and j - w >= 0) sum -= exsus[i - h][j] + exsus[i][j - w] - exsus[i - h][j - w]; else if(i - h >= 0 ) sum -= exsus[i - h][j]; else if(j - w >= 0) sum -= exsus[i][j - w]; if(sum >= 0) { breturn true; } } breturn false; } int rectangle(int R, int C, int H, int W, int Q[3001][3001]) { mat = Q; r = R; c = C; h = H; w = W; for(int i = 0; i < r; i++) for(int j = 0; j < c; j++) cin >> mat[i][j]; while(hi != lo) { mid = (hi + lo)/2; if(fun()) hi = mid; else lo = mid + 1; } breturn hi; }

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

quality.cpp: In function 'int rectangle(int, int, int, int, int (*)[3001])':
quality.cpp:36:6: error: incompatible types in assignment of 'int (*)[3001]' to 'int [3001][3001]'
   36 |  mat = Q;
      |  ~~~~^~~