제출 #208887

#제출 시각아이디문제언어결과실행 시간메모리
208887DodgeBallMan삶의 질 (IOI10_quality)C++14
0 / 100
67 ms35960 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[3001][3001] ) { 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[3001][3001] ) { 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 m = l + r + 1 >> 1; if( chk( m, rec ) ) l = m; else r = m - 1; } return l; }

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

quality.cpp: In function 'int rectangle(int, int, int, int, int (*)[3001])':
quality.cpp:35:23: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
         int m = l + r + 1 >> 1;
                 ~~~~~~^~~
#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...