제출 #1229885

#제출 시각아이디문제언어결과실행 시간메모리
1229885PlayVoltz삶의 질 (IOI10_quality)C++20
컴파일 에러
0 ms0 KiB
#include "quality.h"
#include <bits/stdc++.h>
using namespace std;

int rectangle(int n, int m, int h, int w, int vect[3001][3001]){
	int low=0, high=n*m;
	while (low+1<high){
		int mid=(low+high)/2, mx=0;
		vector<vector<int> > psum(n+1, vector<int>(m+1, 0));
		for (int i=1; i<=n; ++i)for (int j=1; j<=m; ++j)psum[i][j]=psum[i][j-1]+(vect[i-1][j-1]<mid);
		for (int int j=1; j<=m; ++j)for (int i=1; i<=n; ++i)psum[i][j]+=psum[i-1][j];
		for (int i=h; i<=n; ++i)for (int j=w; j<=m; ++j)mx=max(mx, psum[i][j]-psum[i-h][j]-psum[i][j-w]+psum[i-h][j-w]);
		if (mx>=h*w/2)high=mid;
		else low=mid;
	}
	return high;
}

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

quality.cpp: In function 'int rectangle(int, int, int, int, int (*)[3001])':
quality.cpp:11:22: error: two or more data types in declaration of 'j'
   11 |                 for (int int j=1; j<=m; ++j)for (int i=1; i<=n; ++i)psum[i][j]+=psum[i-1][j];
      |                      ^~~
quality.cpp:11:35: error: 'j' was not declared in this scope
   11 |                 for (int int j=1; j<=m; ++j)for (int i=1; i<=n; ++i)psum[i][j]+=psum[i-1][j];
      |                                   ^