Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
51585 lz 最优子图 C++ 解答错误 10 20 MS 264 KB 630 2022-07-13 11:54:11

Tests(2/20):


#include <bits/stdc++.h> using namespace std; const int N=5e5+5; long long n,k; long long a[N],w[N],x; long long ans,cnt=9223372036854775807; int main() { // freopen("sub.in","r",stdin); //freopen("sub.out","w",stdout); scanf("%lld%lld",&n,&k); for(int i=1; i<=n; i++) { for(int j=1; j<=n; j++) { scanf("%lld",&x); a[i]+=x; w[i]+=k-x; ans+=x; } } ans>>=1; for(int i=1; i<=n; i++) { cnt=min(cnt,a[i]*2-k*(n-1)); } printf("%d\n",ans-cnt); return 0; } /* 5 20 0 13 15 10 14 13 0 12 12 12 15 12 0 18 20 10 12 18 0 13 14 12 20 13 0 */


测评信息: