제출 #893893

#제출 시각아이디문제언어결과실행 시간메모리
893893Irate삶의 질 (IOI10_quality)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; vector<vector<int>>grid; bool check(vector<vector<int>>&pref, int R, int C, int H, int W){ for(int i = 1;i <= R;++i){ for(int j = 1;j <= C;++j){ if(i + H - 1 <= R && j + W - 1 <= C){ int num = pref[i + H - 1][j + W - 1] - pref[i - 1][j + W - 1] - pref[i + H - 1][j - 1] + pref[i - 1][j - 1]; if(num >= H * W / 2 + 1)return true; } } } return false; } int rectangle(int R, int C, int H, int W, vector<vector<int>>&Q){ grid.assign(R + 1, vector<int>(C + 1)); for(int i = 1;i <= R;++i){ for(int j = 1;j <= C;++j){ grid[i][j] = Q[i - 1][j - 1]; } } int l = 1, r = R * C, ans = r; while(l <= r){ int mid = (l + r) >> 1; vector<vector<int>>pref(R + 1, vector<int>(C + 1)); for(int i = 1;i <= R;++i){ for(int j = 1;j <= C;++j){ if(grid[i][j] <= mid){ pref[i][j]++; } pref[i][j] += pref[i - 1][j] + pref[i][j - 1] - pref[i - 1][j - 1]; } } if(check(pref, R, C, H, W)){ ans = mid; r = mid - 1; } else{ l = mid + 1; } } return ans; } // int main(){ // ios_base::sync_with_stdio(0); // cin.tie(0); // int n, m, H, W; // cin >> n >> m >> H >> W; // vector<vector<int>>v(n, vector<int>(m)); // for(int i = 0;i < n;++i){ // for(int j = 0;j < m;++j){ // cin >> v[i][j]; // } // } // cout << rectangle(n, m, H, W, v); // }

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

/usr/bin/ld: /tmp/ccQB9uCF.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