社区讨论
一个玄学的问题
P12245共同兴趣参与者 1已保存回复 0
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 0 条
- 当前快照
- 1 份
- 快照标识符
- @mi8td30s
- 此快照首次捕获于
- 2025/11/21 20:05 4 个月前
- 此快照最后确认于
- 2025/11/21 21:00 4 个月前
我的代码本来55分
CPP#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,m,a[510][510],c[510],d[510],ptr,res,ans;
queue<int> q;
signed main(){
cin>>n>>m;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cin>>a[i][j];
}
}
for(int i=1;i<n;i++){
for(int j=1;j<n;j++){
if(i==j)continue;
int x=0;
for(int k=0;k<m;k++){
if(a[i][k]==1&&a[j][k]==1){
x++;
}
}
c[i]=max(c[i],x);
}
}
for(int i=0;i<m;i++){
if(a[0][i]==1)continue;
for(int j=0;j<n;j++){
if(a[j][i]==1)d[j]++;
}
if(d[i]>=res){
res=max(res,d[i]);
q.push(i);
}
}
while(!q.empty()){
int x=q.front();
q.pop();
a[0][x]=1;
int an=0;
for(int i=1;i<n;i++){
int y=0;
for(int j=0;j<m;j++){
if(a[0][j]==1&&a[i][j]==1){
y++;
}
}
if(y>=c[i]){
an++;
}
}
ans=max(ans,an);
a[0][x]=0;
}
cout<<ans;
}
然后删掉了下面的1,2,4行
CPPif(d[i]>=res){
res=max(res,d[i]);
q.push(i);
}
然后这玩意100了
感觉这个新代码有问题,但是能跑满分,求hack
回复
共 0 条回复,欢迎继续交流。
正在加载回复...