UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#147484#25. CWHLTXDY20605ms1188kbC++111.1kb2022-03-24 12:48:202022-03-24 13:03:28

answer

#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;

#define x first
#define y second
#define set(x,y) memset(x,y,sizeof(x))
#define cpy(x,y) memcpy(x,y,sizeof(x))

typedef long long LL;
typedef __int128 LLL;
typedef unsigned long long ULL;
typedef double D;
typedef pair<int,int> PII;
typedef pair<int,LL> PIL;
typedef pair<D,D> PDD;

const LL INFLL=0x3f3f3f3f3f3f3f3f;
const int INF=0x3f3f3f3f;
const int mod=1e9+9;
const int N=205;

int n,m;
int a[N],b[N];
int mxa[N],mxb[N];

int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;++i){
		scanf("%d",a+i);
		if(!a[i]) --i,--n;
	}
	for(int i=1;i<=m;++i){
		scanf("%d",b+i);
		if(!b[i]) --i,--m;
	}
	int ans=0;
	for(int s=0;s<1<<n+m;++s){
		int cnt=0,res=1;
		for(int i=0;i<n+m;++i)
			if(s>>i&1){
				++cnt;
				if(i<n) --a[i+1];
				else --b[i-n+1];
			}
		for(int i=1;i<=n;++i)
			for(int j=1;j<=m;++j)
				res=(LL)res*(min(a[i],b[j])+1)%mod;
		for(int i=0;i<n+m;++i)
			if(s>>i&1){
				if(i<n) ++a[i+1];
				else ++b[i-n+1];
			}
		if(cnt&1) ans=(ans+mod-res)%mod;
		else ans=(ans+res)%mod;
	}
	printf("%d\n",ans);
	return 0;
}

Details

小提示:点击横条可展开更详细的信息

Test #1:

score: 10
Accepted
time: 312ms
memory: 1184kb

input:

10 9
171 183 183 173 200 162 171 200 200 183
200 183 183 200 183 176 171 183 200

output:

6260605

result:

ok 1 number(s): "6260605"

Test #2:

score: 10
Accepted
time: 31ms
memory: 1184kb

input:

8 8
95 200 93 186 177 188 187 183
188 186 188 200 177 186 158 152

output:

456423752

result:

ok 1 number(s): "456423752"

Test #3:

score: 0
Wrong Answer
time: 0ms
memory: 1184kb

input:

50 48
194 194 194 194 194 194 194 194 194 194 194 194 194 187 194 185 194 187 187 194 194 194 194 19...

output:

531870485

result:

wrong answer 1st numbers differ - expected: '60673517', found: '531870485'

Test #4:

score: 0
Wrong Answer
time: 2ms
memory: 1188kb

input:

50 48
196 193 196 196 196 196 196 196 196 196 196 196 196 196 196 196 193 196 193 182 196 196 196 19...

output:

467822921

result:

wrong answer 1st numbers differ - expected: '350486125', found: '467822921'

Test #5:

score: 0
Wrong Answer
time: 27ms
memory: 1188kb

input:

197 194
161 64 63 125 186 64 63 126 57 173 186 133 190 173 185 49 125 186 92 35 64 30 64 83 126 190 ...

output:

665801689

result:

wrong answer 1st numbers differ - expected: '364409852', found: '665801689'

Test #6:

score: 0
Wrong Answer
time: 14ms
memory: 1188kb

input:

190 200
117 182 199 170 101 105 150 61 178 105 23 171 177 57 66 182 117 90 178 185 12 185 73 150 23 ...

output:

943025394

result:

wrong answer 1st numbers differ - expected: '100207499', found: '943025394'

Test #7:

score: 0
Wrong Answer
time: 53ms
memory: 1188kb

input:

199 193
103 41 60 189 60 103 41 41 97 103 60 8 41 128 60 128 128 60 135 189 94 7 61 97 135 178 97 41...

output:

694117068

result:

wrong answer 1st numbers differ - expected: '956252981', found: '694117068'

Test #8:

score: 0
Wrong Answer
time: 105ms
memory: 1188kb

input:

196 197
182 187 99 75 59 53 53 174 187 187 115 106 75 75 59 111 111 99 38 146 75 146 117 182 75 183 ...

output:

226389533

result:

wrong answer 1st numbers differ - expected: '307573290', found: '226389533'

Test #9:

score: 0
Wrong Answer
time: 53ms
memory: 1184kb

input:

195 197
111 162 129 42 94 64 77 77 131 119 77 131 52 162 195 46 52 42 140 64 119 46 140 135 46 77 2 ...

output:

705205322

result:

wrong answer 1st numbers differ - expected: '630722514', found: '705205322'

Test #10:

score: 0
Wrong Answer
time: 8ms
memory: 1188kb

input:

190 199
159 82 32 52 186 159 171 191 171 52 186 163 12 106 12 106 82 82 163 182 171 182 12 198 84 10...

output:

996349989

result:

wrong answer 1st numbers differ - expected: '54844873', found: '996349989'