Submission #60165751


Source Code Expand

#include<bits/stdc++.h>
#include"atcoder/all"
using namespace std;
using namespace atcoder;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) a.begin(),a.end()
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> P;
const ll mod=998244353;
const ll inf=1ll<<61;
typedef modint998244353 mi;

int p[8][10005];

int main(){
	int h,w;cin>>h>>w;
	rep(i,h){
		rep(j,w)cin>>p[i][j];
	}
	int ans=0;

	for(int i=1;i<(1<<h);i++){
		map<int,int>M;
		rep(j,w){
			vector<int>val;
			rep(k,h){
				if(i&(1<<k))val.push_back(p[k][j]);
			}
			sort(all(val));
			if(val[0]==val[val.size()-1])M[val[0]]++;
		}
		int mx=0;
		for(auto &e:M)mx=max(mx,e.second);
		ans=max(ans,mx*__builtin_popcount(i));
	}
	cout<<ans<<endl;
}

Submission Info

Submission Time
Task 063 - Monochromatic Subgrid(★4)
User Rho17
Language C++ 20 (gcc 12.2)
Score 4
Code Size 760 Byte
Status AC
Exec Time 232 ms
Memory 4288 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 4 / 4
Status
AC × 3
AC × 27
Set Name Test Cases
Sample 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_h1_w1.txt, 01_h8_w1.txt, 10_small_random_01.txt, 10_small_random_02.txt, 10_small_random_03.txt, 10_small_random_04.txt, 10_small_random_05.txt, 10_small_random_06.txt, 10_small_random_07.txt, 10_small_random_08.txt, 50_large_random_01.txt, 50_large_random_02.txt, 50_large_random_03.txt, 50_large_random_04.txt, 50_large_random_05.txt, 50_large_random_06.txt, 50_large_random_07.txt, 50_large_random_08.txt, 70_h1_w10000.txt, 80_almost_monochromatic.txt, 80_bichromatic.txt, 80_chess_board.txt, 80_colorful.txt, 80_monochromatic.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 1 ms 3604 KiB
00_sample_02.txt AC 1 ms 3512 KiB
00_sample_03.txt AC 1 ms 3520 KiB
01_h1_w1.txt AC 1 ms 3500 KiB
01_h8_w1.txt AC 1 ms 3500 KiB
10_small_random_01.txt AC 1 ms 3668 KiB
10_small_random_02.txt AC 1 ms 3468 KiB
10_small_random_03.txt AC 1 ms 3504 KiB
10_small_random_04.txt AC 1 ms 3468 KiB
10_small_random_05.txt AC 1 ms 3516 KiB
10_small_random_06.txt AC 1 ms 3516 KiB
10_small_random_07.txt AC 1 ms 3616 KiB
10_small_random_08.txt AC 1 ms 3508 KiB
50_large_random_01.txt AC 1 ms 3516 KiB
50_large_random_02.txt AC 2 ms 3524 KiB
50_large_random_03.txt AC 3 ms 3684 KiB
50_large_random_04.txt AC 8 ms 3680 KiB
50_large_random_05.txt AC 15 ms 3824 KiB
50_large_random_06.txt AC 33 ms 3808 KiB
50_large_random_07.txt AC 82 ms 3876 KiB
50_large_random_08.txt AC 186 ms 4092 KiB
70_h1_w10000.txt AC 2 ms 3508 KiB
80_almost_monochromatic.txt AC 161 ms 3784 KiB
80_bichromatic.txt AC 200 ms 3704 KiB
80_chess_board.txt AC 162 ms 3768 KiB
80_colorful.txt AC 232 ms 4288 KiB
80_monochromatic.txt AC 160 ms 3804 KiB