Submission #208885

#TimeUsernameProblemLanguageResultExecution timeMemory
208885DodgeBallManQuality Of Living (IOI10_quality)C++14
Compilation error
0 ms0 KiB
#include "quality.h" #include <bits/stdc++.h> #define pii pair<int, int> #define x first #define y second using namespace std; const int N = 3e3+5; int sum[N][N], n, c, r, h, w; pii pos[N*N]; bool chk( int mid, int rec[N][N] ) { memset( sum, 0, sizeof sum ); for( int i = mid + 1 ; i <= n ; i++ ) sum[pos[i].x][pos[i].y]++; for( int i = 1 ; i <= r ; i++ ) for( int j = 1 ; j <= c ; j++ ) sum[i][j] += sum[i-1][j] + sum[i][j-1] - sum[i-1][j-1]; for( int i = h ; i <= r ; i++ ) for( int j = w ; j <= c ; j++ ) if( sum[i][j] - sum[i-h][j] - sum[i][j-w] + sum[i-h][j-w] <= h * w / 2 ) return true; return false; } int rectangle( int R, int C, int H, int W, int rec[N][N] ) { r = R, c = C, w = W, h = H; n = r*c; for( int i = 0 ; i < r ; i++ ) for( int j = 0 ; j < c ; j++ ) pos[rec[i][j]] = pii( i+1, j+1 ); int l = 1, r = n; while( l < r ) { int mid = l + r + 1 >> 1; if( chk( mid, rec ) ) l = m; else r = m - 1; } return l; }

Compilation message (stderr)

quality.cpp: In function 'int rectangle(int, int, int, int, int (*)[3005])':
quality.cpp:35:25: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
         int mid = l + r + 1 >> 1;
                   ~~~~~~^~~
quality.cpp:36:35: error: 'm' was not declared in this scope
         if( chk( mid, rec ) ) l = m;
                                   ^
quality.cpp:37:18: error: 'm' was not declared in this scope
         else r = m - 1;
                  ^