Submission #303036

#TimeUsernameProblemLanguageResultExecution timeMemory
303036iliccmarkoQuality Of Living (IOI10_quality)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include<quality.h> using namespace std; #define ll long long #define endl "\n" using namespace std; int rectange(int r, int c, int h, int w, int **q) { int l = 1; int r = r*c; int ans; while(l<=r) { int mid = (l+r)/2; int mat[r][c]; for(int i = 0;i<r;i++) { for(int j = 0;j<c;j++) { if(q[i][j]<mid) mat[i][j] = -1; else if(q[i][j]==mid) mat[i][j] = 0; else mat[i][j] = 1; } } int prefix[r][c]; for(int i = 0;i<r;i++) { for(int j = 0;j<c;j++) { if(j==0) { prefix[i][j] = mat[i][j]; } else { prefix[i][j] = prefix[i][j-1] + mat[i][j]; } } } int b, s, e; b = s = e = 0; int sum = 0; for(int i = w-1;i<c;i++) { for(int j = 0;j<h;j++) { if(i==w-1) { sum+=prefix[j][w-1]; } else { sum+=prefix[j][i] - prefix[j][i-w]; } } for(int j = w;j<=h;j++) { if(sum<0) { s++; break; } else if(sum==0) { e++; } if(j==h) break; if(i==w-1) { sum-=prefix[j-h][w-1]; sum+=prefix[j][w-1]; } else { sum-=prefix[j-h][i-w]; sum+=prefix[j][i-w]; } } if(s!=0) break; } if(s) { r = mid - 1; } else if(e) { ans = mid; l = mid + 1; } else { l = mid + 1; } } return ans; }

Compilation message (stderr)

quality.cpp: In function 'int rectange(int, int, int, int, int**)':
quality.cpp:12:9: error: declaration of 'int r' shadows a parameter
   12 |     int r = r*c;
      |         ^