QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#403715#8319. Emiya 家明天的饭dingdingtang11514#0 0ms0kbC++141.3kb2024-05-02 17:53:402024-05-02 17:53:41

Judging History

你现在查看的是最新测评结果

  • [2024-05-02 17:53:41]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2024-05-02 17:53:40]
  • 提交

answer

#include <iostream>
#include <cstring> 
#include <map>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
#include <set>
// #include <bits/stdc++.h>

// #define int long long
#define For(i,a,b) for(int i=(a);i<=(b);i++)
#define Rof(i,a,b) for(int i=(a);i>=(b);i--)
#define Grf(it,u,to) for(int it=he[u],to;(to=e[it],it);it=nxt[it]) 
#define In __inline 
#define OP operator
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
namespace Mine {
	// mt19937_64 wql(514);
	In ll read() {
		ll x=1,a=0;
		char ch=getchar();
		while(ch>'9' || ch<'0') x=(ch=='-')?-1:x,ch=getchar();
		while(ch>='0' && ch<='9') a=(a<<1)+(a<<3)+(ch-'0'),ch=getchar();
		return a*x;
	} const int N=21,M=1e6+100;
	int a[N][M],t[N],f[(1<<N)+1000],g[(1<<N)+1000];
	signed main() {
		int n=read(),m=read(),tot=0;
		For(i,0,n-1) For(j,1,m) {a[i][j]=read();if(a[i][j]!=-1) tot+=a[i][j];}
		if(n>14) printf("%d",tot);
		For(i,0,n-1) For(j,1,m) if(a[i][j]!=-1) t[j]|=(1<<i);
		For(i,0,n-1) For(j,1,m) if(a[i][j]!=-1) f[t[j]]+=a[i][j],f[t[j]^(1<<i)]-=a[i][j];
		For(i,0,n-1) For(S,0,(1<<n)-1) if(S>>i & 1) f[S^(1<<i)]+=f[S];
		int ans=0;
		For(S,0,(1<<n)-1) ans=max(ans,f[S]);
		return printf("%d",ans),0;
	}
}signed main() {
	// freopen("homework.in","r",stdin);
	// freopen("homework.out","w",stdout);
	return Mine::main();
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Runtime Error

Test #1:

score: 0
Runtime Error

input:

10 2000
577534 -1 -1 1510473 1954923 -1 3088519 -1 9958770 -1 -1 789229936 7476647 -1 -1 -1 -1 -1 8959559 -1 -1 8222549 2329485 -1 -1 -1 -1 -1 9438768 -1 5521504 -1 -1 -1 -1 -1 -1 8497790 1061851 9092355 7487890 5950767 7099280 4539854 -1 873314 -1 2079774 4461992 681211 -1 -1 -1 9453031 -1 -1 31860...

output:


result:


Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Runtime Error

Test #21:

score: 0
Runtime Error

input:

16 1000000
1678292 3506611 3517442 7482059 3235169 7850879 2719736 3579860 8212996 8672372 7235114 6351463 6539238 3596242 517079 6853239 6033392 9054320 7042766 9890810 8455403 8916458 9785849 1807102 1412966 4281493 8750874 8326572 5481267 7653917 40034 4405576 1523421 3568949 6846331 5491786 3132...

output:


result:


Subtask #4:

score: 0
Skipped

Dependency #1:

0%