제출 #853707

#제출 시각아이디문제언어결과실행 시간메모리
853707vjudge1삶의 질 (IOI10_quality)C++98
컴파일 에러
0 ms0 KiB
#include<iostream> #include<cstring> #include<cstdio> using namespace std; int r, c, h, w, a[3010][3010], s[3010][3010]; bool check(int x) { for(int i = 1; i <= r; i++) { for(int j = 1; j <= c; j++) { s[i][j] = s[i - 1][j] + s[i][j - 1] - s[i - 1][j - 1] + (a[i][j] > x); } } for(int i = h; i <= r; i++) { for(int j = w; j <= c; j++) { if(s[i][j] - s[i - h][j] - s[i][j - w] + s[i - h][j - w] <= h * w / 2) return true; } } return false; } inline int read() { int x = 0, f = 1; char ch = getchar(); while(ch >= '0' && ch <= '9') { x = (x << 1) + (x << 3) + ch ^ 48; ch = getchar(); } return x; } int main() { r = read(), c = read(), h = read(), w = read(); for(int i = 1; i <= r; i++) { for(int j = 1; j <= c; j++) { a[i][j] = read(); } } int L = 1, R = r * c; while(L < R) { int mid = (L + R) >> 1; if(check(mid)) R = mid; else L = mid + 1; } printf("%d", L); return 0; }

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

quality.cpp: In function 'int read()':
quality.cpp:32:27: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
   32 |   x = (x << 1) + (x << 3) + ch ^ 48;
      |       ~~~~~~~~~~~~~~~~~~~~^~~~
quality.cpp:28:13: warning: unused variable 'f' [-Wunused-variable]
   28 |  int x = 0, f = 1;
      |             ^
/usr/bin/ld: /tmp/ccjd6wsE.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccwZhWiG.o:quality.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccjd6wsE.o: in function `main':
grader.cpp:(.text.startup+0xe9): undefined reference to `rectangle(int, int, int, int, int (*) [3001])'
collect2: error: ld returned 1 exit status