제출 #831790

#제출 시각아이디문제언어결과실행 시간메모리
831790matthewhutama삶의 질 (IOI10_quality)C++14
0 / 100
101 ms141572 KiB
#include "quality.h" #include <bits/stdc++.h> // #include <stdio.h> // #include <stdlib.h> // #include "quality.h" using namespace std; typedef long long ll; // static int R,C,H,W,Q[3001][3001],i,j,ans; int rectangle(int R, int C, int H, int W, int Q[3001][3001]) { ll lo = 1, hi = R * C, mid, simpan; while (lo <= hi){ mid = (lo + hi) / 2; ll grid[3001][3001]; ll pref[3005][3005]; memset(pref, 0, sizeof(pref)); cout<<mid<<endl; for (int i = 1; i <= R; i++){ for (int j = 1; j <= C; j++){ if (Q[i - 1][j - 1] == mid){ grid[i][j] = 0; } else if (Q[i - 1][j - 1] > mid){ grid[i][j] = 1; } else{ grid[i][j] = -1; } cout << grid[i][j]<<" "; } cout<<endl; } for (int i = 1; i <= R; i++){ for (int j = 1; j <= C; j++){ if (i == 1 && j == 1){ pref[i][j] = grid[i][j]; continue; } pref[i][j] = pref[i - 1][j] + pref[i][j - 1] - pref[i - 1][j - 1] + grid[i][j]; } } ll x = 0; for (int i = 1; i <= R - H + 1; i++){ if (x == 1) break; for (int j = 1; j <= C - W + 1; j++){ ll p = i + H - 1, q = j + W - 1; ll u = pref[p][q] - pref[p][j - 1] - pref[i - 1][q] + pref[i - 1][j - 1]; if (u >= 0){ x = 1; } } } if (x == 0){ hi = mid - 1; } else{ lo = mid + 1; simpan = mid; } } return simpan; } // int main(){ // scanf("%d%d%d%d",&R,&C,&H,&W); // for (i=0;i<R;i++) for (j=0;j<C;j++) scanf("%d",&Q[i][j]); // ans = rectangle(R,C,H,W,Q); // printf("%d\n",ans); // return 0; // }

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

quality.cpp: In function 'int rectangle(int, int, int, int, int (*)[3001])':
quality.cpp:61:12: warning: 'simpan' may be used uninitialized in this function [-Wmaybe-uninitialized]
   61 |     return simpan;
      |            ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...