AcWing 5415. 仓库规划
原题链接
简单
作者:
mc_chen
,
2024-04-21 20:06:09
,
所有人可见
,
阅读 1
算法1
(暴力枚举) $O(n^2)$
C++ 代码
#include<iostream>
#include<algorithm>
using namespace std;
const int N=1010;
int n,m;
struct Store{
int w[11];
bool operator>(Store &S)const{
for(int i=1;i<=m;i++){
if(w[i]<=S.w[i])return false;
}
return true;
}
}s[N];
int res[N];
int main(){
cin>>n>>m;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cin>>s[i].w[j];
}
}
for(int i=1;i<=n;i++){
int res=0;
for(int j=1;j<=n;j++){
if(s[j]>s[i]){
res=j;
break;
}
}
cout<<res<<endl;
}
}