QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#113401#6389. TopicalLFCode12 535ms14388kbC++141.2kb2023-06-17 14:45:412023-06-17 14:45:43

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-17 14:45:43]
  • 评测
  • 测评结果:12
  • 用时:535ms
  • 内存:14388kb
  • [2023-06-17 14:45:41]
  • 提交

answer

#include<cstdio>
#define v(x,y,z) (x[(y-1)*m+z])
const int N=1000086;
int n,m,qh=1,qt=0,ans,q[N],a[N],b[N],cnt[N];
bool del[N<<2];
int read(){
	char ch=getchar();int nn=0,ssss=1;
	while(ch<'0'||ch>'9'){if(ch=='-')ssss*=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){nn=nn*10+(ch-'0');ch=getchar();}
	return nn*ssss;
}
bool build(int k,int l,int r){
	if(l==r){
		for(int i=1;i<=m;i++){cnt[l]+=(v(a,l,i)==0);v(del,k,i)=(v(a,l,i)==0);}
		if(cnt[l]==m)q[++qt]=l;return true;
	}
	int mid=(l+r)>>1;build(k<<1,l,mid);build(k<<1|1,mid+1,r);
	for(int i=1;i<=m;i++)v(del,k,i)=v(del,k<<1,i)&v(del,k<<1|1,i);
	return true;
}
bool change(int k,int l,int r,int x,int f){
	if(l==r){
		v(a,l,f)-=v(b,x,f);v(del,k,f)=(v(a,l,f)<=0);
		cnt[l]+=v(del,k,f);if(cnt[l]==m)q[++qt]=l;return true;
	}
	int mid=(l+r)>>1;
	if(!v(del,k<<1,f))change(k<<1,l,mid,x,f);
	if(!v(del,k<<1|1,f))change(k<<1|1,mid+1,r,x,f);
	v(del,k,f)=v(del,k<<1,f)&v(del,k<<1|1,f);return true;
}
int main(){
	n=read();m=read();
	for(int i=1;i<=n;i++)for(int j=1;j<=m;j++)v(a,i,j)=read();
	build(1,1,n);
	for(int i=1;i<=n;i++)for(int j=1;j<=m;j++)v(b,i,j)=read();
	while(qh<=qt){
		int np=q[qh++];ans++;
		for(int i=1;i<=m;i++)change(1,1,n,np,i);
	}
	printf("%d",ans);
}

詳細信息

Subtask #1:

score: 12
Accepted

Test #1:

score: 12
Accepted
time: 1ms
memory: 5624kb

input:

1 1
693647287
340782526

output:

0

result:

ok 1 number(s): "0"

Test #2:

score: 0
Accepted
time: 1ms
memory: 7660kb

input:

1 100
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
279985824 991797187 998715443 98505529 106002744 636773096 815089164 196160830 796988849 87975...

output:

1

result:

ok 1 number(s): "1"

Test #3:

score: 0
Accepted
time: 0ms
memory: 5516kb

input:

1 10000
841961872 0 0 0 0 0 0 0 0 0 0 0 0 0 831386430 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 205210920 705123207 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 276768098 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 661649446 0 0 0 0 0 0 0 0 0 0 ...

output:

0

result:

ok 1 number(s): "0"

Test #4:

score: 0
Accepted
time: 42ms
memory: 14388kb

input:

1 1000000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

1

result:

ok 1 number(s): "1"

Test #5:

score: 0
Accepted
time: 50ms
memory: 10752kb

input:

1 1000000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

1

result:

ok 1 number(s): "1"

Test #6:

score: 0
Accepted
time: 30ms
memory: 10660kb

input:

1 1000000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

1

result:

ok 1 number(s): "1"

Test #7:

score: 0
Accepted
time: 18ms
memory: 13812kb

input:

1 1000000
100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 10...

output:

0

result:

ok 1 number(s): "0"

Subtask #2:

score: 0
Wrong Answer

Test #8:

score: 0
Wrong Answer
time: 1ms
memory: 7656kb

input:

100 1
893339036
896783899
690308537
201770764
262364362
105000893
770698921
744238454
470980016
935046317
642998516
100481910
392307650
116783134
196939768
372329082
346372520
43063564
245523488
389084350
130314590
412588681
987795927
681635353
304582580
472268968
700147283
743357606
792644412
99955...

output:

50

result:

wrong answer 1st numbers differ - expected: '85', found: '50'

Subtask #3:

score: 0
Wrong Answer

Test #15:

score: 0
Wrong Answer
time: 535ms
memory: 7724kb

input:

10000 1
568857328
651788426
751475430
102940442
763289419
468657944
770847628
780257867
16919385
575963868
281824241
291248174
140016533
313529232
302186452
32709864
787073783
1926820
239509174
220454071
34252400
390385721
675239026
245106357
489697460
28435096
825528061
159083009
16370561
223299279...

output:

7430

result:

wrong answer 1st numbers differ - expected: '10000', found: '7430'

Subtask #4:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%