QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#446665#6389. Topicalsabagoduadze40 94ms105268kbC++23813b2024-06-17 14:52:502024-06-17 14:52:52

Judging History

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

  • [2024-06-17 14:52:52]
  • 评测
  • 测评结果:40
  • 用时:94ms
  • 内存:105268kb
  • [2024-06-17 14:52:50]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N=1e6+5;
int n,k,ans,p,d[N]; bool bl,fx[N];
set <int> s;
signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin>>n>>k; int a[n+5][k+5],b[n+5][k+5];
	for (int i=1; i<=n; i++)
		for (int j=1; j<=k; j++){
			cin>>a[i][j];
		}
	for (int i=1; i<=n; i++)
		for (int j=1; j<=k; j++){
			cin>>b[i][j];
		}
	while (1){
		p=0;
		for (int i=1; i<=n; i++){
			if (fx[i]) continue; bl=0;
			for (int j=1; j<=k; j++){
				if (a[i][j]>0) bl=1;
			}
			if (bl==0){
				p++; fx[i]=1;
				for (int j=1; j<=k; j++){
					d[j]+=b[i][j];
				} 
			}
		}
		if (p==0) break; ans+=p;
		for (int j=1; j<=k; j++){
			for (int i=1; i<=n; i++){
				a[i][j]-=d[j];
			}
			d[j]=0;
		}
	}
	cout<<ans;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 12
Accepted

Test #1:

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

input:

1 1
693647287
340782526

output:

0

result:

ok 1 number(s): "0"

Test #2:

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

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: 12
Accepted
time: 2ms
memory: 4640kb

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: 12
Accepted
time: 87ms
memory: 105204kb

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: 12
Accepted
time: 94ms
memory: 105268kb

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: 12
Accepted
time: 78ms
memory: 105224kb

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: 12
Accepted
time: 59ms
memory: 97328kb

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: 28
Accepted

Test #8:

score: 28
Accepted
time: 1ms
memory: 3724kb

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:

85

result:

ok 1 number(s): "85"

Test #9:

score: 28
Accepted
time: 2ms
memory: 3892kb

input:

100 100
1000000000 828788913 1000000000 894501902 1000000000 898513761 837197514 865900986 809812226 853486369 848261509 888902562 1000000000 881898651 932777249 907237990 892103882 1000000000 870206141 1000000000 776016734 1000000000 889438568 856689807 887799348 859324346 872070680 879391131 10000...

output:

52

result:

ok 1 number(s): "52"

Test #10:

score: 28
Accepted
time: 3ms
memory: 3780kb

input:

100 100
41480899 30067130 58529342 49191374 36083890 45869147 82882297 25460110 21315365 52337344 42838103 95288437 42422092 25746530 28684959 32396052 47213835 14999141 84259101 69379196 58772017 10509388 45699641 41109640 62503495 33775884 57523709 1990663 18948036 30586976 29047423 53910876 76929...

output:

96

result:

ok 1 number(s): "96"

Test #11:

score: 28
Accepted
time: 2ms
memory: 3888kb

input:

100 100
289 86731686 104203973 0 103733663 0 357 55630533 201 168 0 907 867 24344425 14132343 648 0 34115723 1510 0 682 0 203 0 0 79 9 551 0 0 1425 96 0 0 1176 45893369 746 0 98201344 45004383 0 0 0 400 0 108 568 0 0 327 595 0 549 0 0 0 0 0 174193885 769 61287071 447 0 521 0 0 614 190 0 0 0 365 468 ...

output:

52

result:

ok 1 number(s): "52"

Test #12:

score: 28
Accepted
time: 2ms
memory: 3828kb

input:

100 100
102824758 349759604 341038688 116603271 303686244 127648700 278523632 309307131 365722578 26901349 99838567 193058542 293422590 242507478 394727765 296396041 317193797 302169141 396984168 176381845 358508382 102152452 140925666 255760562 342867397 313967511 41268403 121370884 190117747 13885...

output:

81

result:

ok 1 number(s): "81"

Test #13:

score: 28
Accepted
time: 2ms
memory: 3892kb

input:

100 100
700358276 767484068 369674679 148136949 620984557 688090307 550280562 602615728 647381987 652824911 625175678 603007596 705242593 15704638 687562897 633557500 634833702 642307730 744014690 620431202 650797129 618657671 666033337 758270575 696322920 672923821 9955917 718437326 37513776 683145...

output:

73

result:

ok 1 number(s): "73"

Test #14:

score: 28
Accepted
time: 2ms
memory: 3880kb

input:

100 100
1000000000 783946496 1000000000 781539493 760136479 740872442 650771124 806997276 708243352 1000000000 657640762 711461735 1000000000 1000000000 771706381 1000000000 781909316 1000000000 1000000000 623846100 1000000000 625316877 1000000000 1000000000 762255119 1000000000 1000000000 774482788...

output:

53

result:

ok 1 number(s): "53"

Subtask #3:

score: 0
Time Limit Exceeded

Test #15:

score: 21
Accepted
time: 3ms
memory: 4596kb

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:

10000

result:

ok 1 number(s): "10000"

Test #16:

score: 21
Accepted
time: 35ms
memory: 13088kb

input:

100000 1
78763439
671847244
661890823
215179284
804182046
667280820
140277780
822235648
809998506
39559747
459311656
212179350
227573276
606854131
182676019
61302123
281509402
53785090
106827674
911115512
31998233
678388767
75425082
154920343
882021740
976962371
219500493
609794633
780392857
6696241...

output:

68284

result:

ok 1 number(s): "68284"

Test #17:

score: 0
Time Limit Exceeded

input:

100000 1
25138355
17042043
1791957
6455298
6022262
943678542
14813410
711168650
249633996
3186950
16632667
24001382
2843444
25153901
570090758
3077367
2314262
26140773
17228102
497847556
12294116
18909179
422337291
16067561
259209280
289237264
25047202
160449968
12519857
1244368
11282595
29145099
82...

output:


result:


Subtask #4:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

0%