update
This commit is contained in:
parent
6ce2e0fef6
commit
3b702d5e93
@ -0,0 +1,70 @@
|
||||
/*
|
||||
n行m列,Ai取第i行最小值,Bj取第j列最大值
|
||||
想不出来递推和数学,打暴力了。。。。
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
using std::cin, std::cout;
|
||||
using ull = unsigned long long;
|
||||
using ui = unsigned int;
|
||||
|
||||
static constexpr size_t MAX_N {(size_t)1e3+5};
|
||||
static constexpr ull MOD {998244353};
|
||||
static size_t n,m,k;
|
||||
ull mtx[MAX_N][MAX_N];
|
||||
std::set<std::vector<ull>> s;
|
||||
|
||||
template<class T>
|
||||
std::ostream&operator<<(std::ostream &os,const std::vector<T> &v)noexcept{
|
||||
os<<"[";
|
||||
for(size_t i{0};i<v.size()-1;i++){
|
||||
os<<v[i]<<" ,";
|
||||
}
|
||||
cout<<v[v.size()-1]<<"]";
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void dfs(size_t x, size_t y){
|
||||
if(x>n){
|
||||
// cout<<"x:"<<x<<" y:"<<y<<'\n';
|
||||
std::vector<ull> v;
|
||||
for(size_t i=1;i<=n;i++){
|
||||
ull ai {std::numeric_limits<decltype(ai)>::max()};
|
||||
for(size_t j=1;j<=m;j++){
|
||||
ai = std::min(ai,mtx[i][j]);
|
||||
}
|
||||
v.push_back(ai);
|
||||
}
|
||||
for(size_t j {1};j<=m;j++){
|
||||
ull bj {std::numeric_limits<decltype(bj)>::min()};
|
||||
for(size_t i{1};i<=n;i++){
|
||||
bj = std::max(bj,mtx[i][j]);
|
||||
}
|
||||
v.push_back(bj);
|
||||
}
|
||||
// cout<<v<<"\n";
|
||||
s.insert(v);
|
||||
return;
|
||||
}
|
||||
for(ull i{1};i<=k;i++){
|
||||
mtx[x][y]=i;
|
||||
if(y+1>m){
|
||||
dfs(x+1,1);
|
||||
}else{
|
||||
dfs(x,y+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main(){
|
||||
cin>>n>>m>>k;
|
||||
dfs(1,1);
|
||||
cout<<s.size()<<'\n';
|
||||
}
|
Loading…
Reference in New Issue
Block a user