QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#544455#9178. All-You-Can-EatdsbdsbWA 37ms3764kbC++141.7kb2024-09-02 16:52:152024-09-02 16:52:26

Judging History

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

  • [2024-09-02 16:52:26]
  • 评测
  • 测评结果:WA
  • 用时:37ms
  • 内存:3764kb
  • [2024-09-02 16:52:15]
  • 提交

answer

#include<bits/stdc++.h>
#define cfl cout.flush()
#define pb push_back
#define N 1010
using namespace std;
int a[N*10],n,f[N],m=1000,pre[N],sum,used[N*10],ans;
vector<int> op;
vector<int>::iterator it;

int main(){
	int T;
	cin>>T;
	while(T--){
		cin>>n;
		memset(f,0,sizeof f);
		memset(used,0,sizeof used);
		ans=0;
		f[0]=1;
		sum=0;
		int fl=0,fz;
		for(int i=1;i<=n;i++){
			cin>>a[i];
			if(sum>=600&&sum<=1000) fl=1;
			if(fl){
				cout<<"0\nIGNORE\n";
				cfl;
				continue;
			}
			for(int j=m;j>=a[i];j--){
				if(f[j-a[i]]) f[j]=1;
				if(f[j]&&j>ans) ans=j;
			}
			sum+=a[i];
			if(sum>=600&&sum<=1000){
				fl=1;
				cout<<"0\nTAKE\n";
				cfl;
				continue;
			}
			used[i]=1;
			fz=(ans*607/1000)+1;
			fz=sum-fz;
			memset(pre,0,sizeof pre);
			pre[0]=n+1;
			int qfz=0;
			for(int j=1;j<=i;j++) if(used[j]){
				for(int k=fz;k>=a[j];k--) if(pre[k-a[j]]&&!pre[k]) pre[k]=j;
				if(pre[fz]){
					qfz=1;
					break;
				}
			}
//			printf("%d %d %d !!!\n",fz,qfz,sum);
			vector<int>().swap(op);
			if(qfz){
				int cur=fz;
				sum-=cur;
				while(cur){
//					printf("%d %d !\n",cur,pre[cur]);
					used[pre[cur]]=0;
					if(pre[cur]!=i) op.pb(pre[cur]);
					cur-=a[pre[cur]];
				}
			}
			else{
				for(int j=fz;j>=0;j--) if(pre[j]){
					int cur=j;
					sum-=cur;
					while(cur){
//						printf("%d %d !!\n",cur,pre[cur]);
						used[pre[cur]]=0;
						if(pre[cur]!=i) op.pb(pre[cur]);
						cur-=a[pre[cur]];
					}
					break;
				}
			}
			cout<<op.size()<<' ';
			for(auto tt:op) cout<<tt<<' ';
			if(used[i]) cout<<"\nTAKE\n";
			else cout<<"\nIGNORE\n";
			cfl;
		}
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3764kb

input:

1
5
10
13
450
585
465

output:

0 
TAKE
0 
TAKE
2 2 1 
TAKE
0 
IGNORE
0
TAKE

result:

ok OK, worst = 0.975480 (1 test case)

Test #2:

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

input:

1
1
100

output:

0 
TAKE

result:

ok OK, worst = 1.000000 (1 test case)

Test #3:

score: 0
Accepted
time: 9ms
memory: 3692kb

input:

2000
5
535
529
536
588
558
5
515
525
599
507
549
5
561
567
504
557
596
5
592
503
549
549
536
5
590
572
589
540
544
5
524
553
545
555
543
5
523
571
577
506
594
5
519
527
521
587
539
5
561
569
573
552
587
5
571
515
585
525
589
5
512
572
565
516
527
5
573
579
564
514
557
5
518
595
509
518
549
5
549
541...

output:

0 
TAKE
1 1 
TAKE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
TAKE
0 
IGNORE
0 
IGNORE
1 1 
TAKE
0 
IGNORE
0 
TAKE
0 
IGNORE
1 1 
TAKE
0 
IGNORE
0 
IGNORE
0 
TAKE
1 1 
TAKE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
TAKE
1 1 
TAKE
0 
IGNORE
1 2 
TAKE
0 
IGNORE
0 
TAKE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
TAKE
0 
I...

result:

ok OK, worst = 0.836394 (2000 test cases)

Test #4:

score: 0
Accepted
time: 3ms
memory: 3692kb

input:

500
20
535
529
536
588
558
515
525
599
507
549
561
567
504
557
596
592
503
549
549
536
20
590
572
589
540
544
524
553
545
555
543
523
571
577
506
594
519
527
521
587
539
20
561
569
573
552
587
571
515
585
525
589
512
572
565
516
527
573
579
564
514
557
20
518
595
509
518
549
549
541
580
535
531
540
...

output:

0 
TAKE
1 1 
TAKE
0 
IGNORE
0 
IGNORE
0 
IGNORE
1 2 
TAKE
0 
IGNORE
0 
IGNORE
1 6 
TAKE
0 
IGNORE
0 
IGNORE
0 
IGNORE
1 9 
TAKE
0 
IGNORE
0 
IGNORE
0 
IGNORE
1 13 
TAKE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
TAKE
1 1 
TAKE
0 
IGNORE
1 2 
TAKE
0 
IGNORE
1 4 
TAKE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
1 6...

result:

ok OK, worst = 0.836394 (500 test cases)

Test #5:

score: 0
Accepted
time: 24ms
memory: 3704kb

input:

200
50
535
529
536
588
558
515
525
599
507
549
561
567
504
557
596
592
503
549
549
536
590
572
589
540
544
524
553
545
555
543
523
571
577
506
594
519
527
521
587
539
561
569
573
552
587
571
515
585
525
589
50
512
572
565
516
527
573
579
564
514
557
518
595
509
518
549
549
541
580
535
531
540
596
51...

output:

0 
TAKE
1 1 
TAKE
0 
IGNORE
0 
IGNORE
0 
IGNORE
1 2 
TAKE
0 
IGNORE
0 
IGNORE
1 6 
TAKE
0 
IGNORE
0 
IGNORE
0 
IGNORE
1 9 
TAKE
0 
IGNORE
0 
IGNORE
0 
IGNORE
1 13 
TAKE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0...

result:

ok OK, worst = 0.836394 (200 test cases)

Test #6:

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

input:

100
100
535
529
536
588
558
515
525
599
507
549
561
567
504
557
596
592
503
549
549
536
590
572
589
540
544
524
553
545
555
543
523
571
577
506
594
519
527
521
587
539
561
569
573
552
587
571
515
585
525
589
512
572
565
516
527
573
579
564
514
557
518
595
509
518
549
549
541
580
535
531
540
596
516
...

output:

0 
TAKE
1 1 
TAKE
0 
IGNORE
0 
IGNORE
0 
IGNORE
1 2 
TAKE
0 
IGNORE
0 
IGNORE
1 6 
TAKE
0 
IGNORE
0 
IGNORE
0 
IGNORE
1 9 
TAKE
0 
IGNORE
0 
IGNORE
0 
IGNORE
1 13 
TAKE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0...

result:

ok OK, worst = 0.836394 (100 test cases)

Test #7:

score: 0
Accepted
time: 20ms
memory: 3684kb

input:

10
1000
535
529
536
588
558
515
525
599
507
549
561
567
504
557
596
592
503
549
549
536
590
572
589
540
544
524
553
545
555
543
523
571
577
506
594
519
527
521
587
539
561
569
573
552
587
571
515
585
525
589
512
572
565
516
527
573
579
564
514
557
518
595
509
518
549
549
541
580
535
531
540
596
516
...

output:

0 
TAKE
1 1 
TAKE
0 
IGNORE
0 
IGNORE
0 
IGNORE
1 2 
TAKE
0 
IGNORE
0 
IGNORE
1 6 
TAKE
0 
IGNORE
0 
IGNORE
0 
IGNORE
1 9 
TAKE
0 
IGNORE
0 
IGNORE
0 
IGNORE
1 13 
TAKE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0...

result:

ok OK, worst = 0.836394 (10 test cases)

Test #8:

score: 0
Accepted
time: 28ms
memory: 3716kb

input:

1
10000
535
529
536
588
558
515
525
599
507
549
561
567
504
557
596
592
503
549
549
536
590
572
589
540
544
524
553
545
555
543
523
571
577
506
594
519
527
521
587
539
561
569
573
552
587
571
515
585
525
589
512
572
565
516
527
573
579
564
514
557
518
595
509
518
549
549
541
580
535
531
540
596
516
...

output:

0 
TAKE
1 1 
TAKE
0 
IGNORE
0 
IGNORE
0 
IGNORE
1 2 
TAKE
0 
IGNORE
0 
IGNORE
1 6 
TAKE
0 
IGNORE
0 
IGNORE
0 
IGNORE
1 9 
TAKE
0 
IGNORE
0 
IGNORE
0 
IGNORE
1 13 
TAKE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0 
IGNORE
0...

result:

ok OK, worst = 0.836394 (1 test case)

Test #9:

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

input:

1
2
2
999

output:

0 
TAKE
1 1 
TAKE

result:

ok OK, worst = 1.000000 (1 test case)

Test #10:

score: 0
Accepted
time: 2ms
memory: 3616kb

input:

100
3
551
450
550
3
552
449
551
3
553
448
552
3
554
447
553
3
555
446
554
3
556
445
555
3
557
444
556
3
558
443
557
3
559
442
558
3
560
441
559
3
561
440
560
3
562
439
561
3
563
438
562
3
564
437
563
3
565
436
564
3
566
435
565
3
567
434
566
3
568
433
567
3
569
432
568
3
570
431
569
3
571
430
570
3
...

output:

0 
TAKE
1 1 
TAKE
0
TAKE
0 
TAKE
1 1 
TAKE
0
TAKE
0 
TAKE
1 1 
TAKE
0
TAKE
0 
TAKE
1 1 
TAKE
0
TAKE
0 
TAKE
1 1 
TAKE
0
TAKE
0 
TAKE
1 1 
TAKE
0
TAKE
0 
TAKE
1 1 
TAKE
0
TAKE
0 
TAKE
1 1 
TAKE
0
TAKE
0 
TAKE
1 1 
TAKE
0
TAKE
0 
TAKE
1 1 
TAKE
0
TAKE
0 
TAKE
1 1 
TAKE
0
TAKE
0 
TAKE
1 1 
TAKE
0
TAKE
...

result:

ok OK, worst = 0.600000 (100 test cases)

Test #11:

score: 0
Accepted
time: 17ms
memory: 3628kb

input:

41
238
1
0
0
4
1
2
0
5
0
5
1
5
2
3
5
1
1
5
5
2
1
3
4
1
5
0
4
1
5
3
1
4
4
1
1
4
2
2
1
0
4
1
5
1
2
4
3
4
0
2
2
0
3
3
4
2
2
1
2
0
3
5
3
3
1
2
4
3
3
3
0
3
1
1
0
4
5
4
1
3
5
2
0
1
0
2
3
0
5
4
5
5
5
1
5
5
5
2
1
4
0
0
4
3
2
5
0
4
1
1
5
3
5
2
3
1
3
3
0
2
3
1
2
3
5
0
5
2
3
5
3
0
3
4
1
0
1
3
1
2
0
4
5
4
3
0
4...

output:

0 
TAKE
0 
TAKE
0 
TAKE
1 1 
TAKE
0 
IGNORE
0 
TAKE
0 
TAKE
1 6 
TAKE
0 
TAKE
0 
TAKE
0 
IGNORE
1 4 
TAKE
0 
TAKE
1 13 
TAKE
0 
TAKE
0 
IGNORE
0 
IGNORE
1 14 
TAKE
0 
TAKE
0 
IGNORE
0 
IGNORE
0 
TAKE
1 22 
TAKE
0 
TAKE
1 24 
TAKE
0 
TAKE
0 
TAKE
0 
IGNORE
1 23 
TAKE
0 
TAKE
0 
IGNORE
0 
TAKE
1 27 
T...

result:

ok OK, worst = 0.752632 (41 test cases)

Test #12:

score: 0
Accepted
time: 13ms
memory: 3688kb

input:

2000
5
174
966
564
649
8
5
58
211
929
70
340
5
481
864
73
407
722
5
181
417
607
419
28
5
429
40
935
257
913
5
387
532
505
446
80
5
187
486
713
23
81
5
61
330
611
918
736
5
939
19
164
889
679
5
847
644
540
944
848
5
618
224
362
561
336
5
504
875
211
808
227
5
104
528
433
537
106
5
997
485
442
729
421...

output:

0 
TAKE
1 1 
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0 
TAKE
1 1 
TAKE
1 2 
TAKE
0
IGNORE
0
IGNORE
0 
TAKE
1 1 
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0 
TAKE
1 1 
TAKE
1 2 
TAKE
0
IGNORE
0
IGNORE
0 
TAKE
0 
IGNORE
1 1 
TAKE
0
IGNORE
0
IGNORE
0 
TAKE
0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0 
TAKE
0
TAKE
0
IGNORE
0
IGNO...

result:

ok OK, worst = 0.601805 (2000 test cases)

Test #13:

score: 0
Accepted
time: 11ms
memory: 3680kb

input:

500
20
257
850
484
19
260
795
649
823
847
785
883
806
760
527
836
398
717
793
505
920
20
602
270
83
569
324
821
160
88
863
241
365
659
169
329
289
544
486
993
18
131
20
91
3
531
209
146
382
603
943
649
951
599
740
700
668
33
953
491
567
431
124
20
413
889
893
880
489
241
977
840
588
76
499
965
550
1...

output:

0 
TAKE
1 1 
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGN...

result:

ok OK, worst = 0.601602 (500 test cases)

Test #14:

score: 0
Accepted
time: 15ms
memory: 3604kb

input:

200
50
765
60
167
6
14
909
568
956
634
989
680
921
775
440
340
86
164
753
490
330
489
956
469
611
818
727
668
868
265
772
309
785
478
43
246
707
683
54
53
21
785
999
295
142
836
170
855
273
239
199
50
807
203
169
579
61
866
899
885
826
463
315
416
570
960
724
140
203
583
657
209
81
403
278
829
184
9...

output:

0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGN...

result:

ok OK, worst = 0.601000 (200 test cases)

Test #15:

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

input:

100
100
371
754
81
983
173
477
417
930
677
688
917
728
614
592
18
443
31
50
450
875
618
78
331
859
489
750
199
690
916
199
544
781
776
852
134
924
504
454
151
403
437
650
74
380
799
149
711
241
363
651
963
407
536
934
332
807
505
169
253
908
397
754
11
366
2
327
664
188
292
129
758
225
405
778
843
8...

output:

0 
TAKE
1 1 
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
I...

result:

ok OK, worst = 0.619000 (100 test cases)

Test #16:

score: 0
Accepted
time: 6ms
memory: 3708kb

input:

10
1000
553
578
500
171
123
425
569
562
982
423
854
460
650
46
602
10
608
92
335
209
527
351
70
878
180
393
853
337
384
129
605
156
616
95
108
571
217
289
720
519
415
908
96
572
829
237
556
692
352
544
681
377
543
576
674
496
857
330
817
757
542
995
399
165
54
319
950
456
56
479
62
427
68
723
838
61...

output:

0 
TAKE
0 
IGNORE
1 1 
TAKE
0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IG...

result:

ok OK, worst = 0.671000 (10 test cases)

Test #17:

score: 0
Accepted
time: 14ms
memory: 3720kb

input:

1
10000
67
998
689
431
382
267
201
867
717
51
275
497
104
321
860
588
341
979
671
119
801
91
90
879
824
47
811
806
314
189
981
688
551
69
756
283
362
858
837
187
983
930
979
292
225
82
6
681
245
262
650
384
184
607
53
848
707
893
665
901
783
72
197
908
357
606
217
220
405
784
263
781
13
717
301
143
...

output:

0 
TAKE
1 1 
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
I...

result:

ok OK, worst = 0.998000 (1 test case)

Test #18:

score: 0
Accepted
time: 8ms
memory: 3748kb

input:

2000
5
697
794
850
796
920
5
476
830
763
703
763
5
815
925
804
645
734
5
927
587
888
668
874
5
904
673
978
979
624
5
1000
459
870
739
806
5
876
523
541
902
820
5
594
957
882
847
808
5
643
899
811
641
884
5
218
904
472
838
677
5
703
797
801
785
679
5
861
891
792
789
546
5
960
944
840
972
240
5
931
61...

output:

0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0 
TAKE
1 1 
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNO...

result:

ok OK, worst = 0.604230 (2000 test cases)

Test #19:

score: 0
Accepted
time: 13ms
memory: 3620kb

input:

500
20
914
849
781
666
924
693
916
765
964
602
988
705
506
798
648
887
991
939
450
771
20
939
678
879
990
905
484
910
914
923
812
705
826
486
924
912
437
794
812
607
853
20
952
891
760
823
653
583
989
534
916
242
959
703
470
714
816
834
882
391
993
915
20
606
987
613
371
443
965
558
678
957
823
743
...

output:

0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNOR...

result:

ok OK, worst = 0.605000 (500 test cases)

Test #20:

score: 0
Accepted
time: 8ms
memory: 3744kb

input:

200
50
990
836
878
781
799
968
900
499
839
159
901
945
704
867
401
448
939
851
858
253
615
913
906
764
901
752
975
967
737
753
552
323
746
665
376
884
792
967
970
955
890
944
601
929
788
682
888
979
827
867
50
890
948
832
825
868
702
971
943
676
651
239
618
176
948
287
594
973
742
623
628
893
982
53...

output:

0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGN...

result:

ok OK, worst = 0.600000 (200 test cases)

Test #21:

score: 0
Accepted
time: 7ms
memory: 3632kb

input:

100
100
904
904
922
898
769
834
860
790
636
948
610
550
647
942
953
863
390
868
774
554
879
694
918
486
699
653
770
617
674
642
643
901
335
783
955
650
678
954
849
846
979
692
668
888
727
894
922
774
841
125
877
627
527
812
789
362
999
1000
982
702
1000
707
772
942
894
253
456
954
953
907
967
400
97...

output:

0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGN...

result:

ok OK, worst = 0.607000 (100 test cases)

Test #22:

score: 0
Accepted
time: 7ms
memory: 3748kb

input:

10
1000
917
931
226
879
806
411
745
895
820
596
505
524
907
121
831
924
706
847
816
919
713
996
615
724
643
850
991
906
696
426
818
528
610
800
446
525
590
960
958
973
739
976
930
991
799
667
761
932
679
911
299
730
886
342
854
894
593
862
309
850
578
480
703
899
803
665
760
876
751
720
662
914
983
...

output:

0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGN...

result:

ok OK, worst = 0.657000 (10 test cases)

Test #23:

score: 0
Accepted
time: 10ms
memory: 3664kb

input:

1
10000
822
951
962
807
949
883
743
859
982
550
572
782
382
727
860
604
908
879
977
768
955
949
964
754
947
960
903
778
814
627
989
971
827
348
818
706
885
547
943
506
520
452
636
861
939
1000
779
967
649
717
876
488
946
784
668
786
691
574
937
340
504
566
877
641
617
682
118
922
1000
801
877
838
90...

output:

0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGN...

result:

ok OK, worst = 0.822000 (1 test case)

Test #24:

score: 0
Accepted
time: 37ms
memory: 3620kb

input:

2000
5
205
339
194
62
717
5
50
569
223
230
160
5
847
250
46
292
277
5
150
640
380
191
335
5
391
85
158
266
256
5
155
368
494
39
140
5
210
77
7
173
0
5
567
112
360
403
228
5
498
101
9
790
71
5
202
245
258
424
179
5
179
191
61
126
111
5
133
168
10
48
167
5
103
304
361
49
107
5
162
25
197
221
9
5
278
4...

output:

0 
TAKE
1 1 
TAKE
0 
TAKE
0 
IGNORE
2 3 2 
TAKE
0 
TAKE
0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0 
TAKE
0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0 
TAKE
0 
IGNORE
0 
IGNORE
0
TAKE
0
IGNORE
0 
TAKE
1 1 
TAKE
0
TAKE
0
IGNORE
0
IGNORE
0 
TAKE
0 
IGNORE
0 
IGNORE
0 
TAKE
0 ...

result:

ok OK, worst = 0.603604 (2000 test cases)

Test #25:

score: 0
Accepted
time: 9ms
memory: 3688kb

input:

500
20
209
34
10
154
96
258
489
274
152
630
152
423
0
211
244
101
479
77
109
232
20
81
20
406
277
2
380
81
1
673
407
400
125
395
160
360
567
93
413
15
308
20
85
221
403
605
13
282
32
464
629
571
117
282
165
459
283
226
281
40
488
605
20
55
684
127
105
75
473
223
87
37
33
54
255
196
44
44
793
111
505...

output:

0 
TAKE
0 
IGNORE
0 
IGNORE
0 
TAKE
0 
IGNORE
0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0 
TAKE
0 
IGNORE
1 1 
TAKE
0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGN...

result:

ok OK, worst = 0.600000 (500 test cases)

Test #26:

score: 0
Accepted
time: 15ms
memory: 3744kb

input:

200
50
173
34
214
261
564
421
363
198
203
34
573
586
155
448
435
2
301
105
521
355
122
52
299
859
4
25
95
322
54
212
449
1
264
200
169
207
119
195
299
604
641
294
507
135
236
372
478
260
10
368
50
503
376
92
267
172
305
119
241
164
2
206
652
402
258
48
150
291
542
135
303
356
27
299
436
292
240
531
...

output:

0 
TAKE
0 
IGNORE
0 
TAKE
0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNO...

result:

ok OK, worst = 0.602000 (200 test cases)

Test #27:

score: 0
Accepted
time: 10ms
memory: 3700kb

input:

100
100
86
504
319
112
142
80
533
439
25
588
295
112
272
100
416
111
136
8
22
16
200
76
420
314
353
520
499
483
398
217
346
1
220
364
56
641
126
232
22
19
36
2
574
241
225
376
88
431
62
210
355
80
119
307
86
103
398
616
259
392
168
56
91
22
242
747
480
709
98
643
123
201
66
37
70
62
260
169
307
43
5...

output:

0 
TAKE
1 1 
TAKE
0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGN...

result:

ok OK, worst = 0.602000 (100 test cases)

Test #28:

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

input:

10
1000
506
35
106
125
356
150
178
129
237
153
635
449
159
467
200
372
116
408
479
36
18
73
91
691
15
302
95
558
13
279
614
235
78
71
225
513
400
471
4
404
295
184
86
228
615
144
420
48
265
29
191
628
6
75
465
68
181
35
71
37
139
596
52
246
232
251
81
77
346
66
332
431
603
197
153
540
66
759
28
322
...

output:

0 
TAKE
0 
IGNORE
0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGN...

result:

ok OK, worst = 0.612000 (10 test cases)

Test #29:

score: 0
Accepted
time: 17ms
memory: 3744kb

input:

1
10000
4
668
256
385
286
192
87
156
142
287
70
190
56
336
45
7
363
97
436
9
70
376
396
41
120
669
271
383
874
109
588
70
362
98
111
264
7
437
91
171
563
432
843
357
43
168
811
177
724
453
354
348
206
199
123
155
144
379
274
216
282
530
446
189
295
292
679
626
305
710
536
227
287
419
428
140
724
314...

output:

0 
TAKE
0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNO...

result:

ok OK, worst = 0.672000 (1 test case)

Test #30:

score: 0
Accepted
time: 14ms
memory: 3760kb

input:

2000
5
999
798
899
771
623
5
874
989
982
992
961
5
793
832
757
899
940
5
855
921
923
924
912
5
895
823
791
778
953
5
890
779
686
932
801
5
889
984
759
634
861
5
908
804
952
812
960
5
826
514
880
875
953
5
968
857
946
972
907
5
896
525
947
839
653
5
838
957
922
780
877
5
904
994
918
658
861
5
703
653...

output:

0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE...

result:

ok OK, worst = 0.604418 (2000 test cases)

Test #31:

score: 0
Accepted
time: 29ms
memory: 3688kb

input:

500
20
987
959
836
988
797
963
858
527
979
665
911
995
984
876
789
997
900
901
918
849
20
780
853
737
849
993
882
735
991
859
905
967
853
875
971
998
927
936
551
620
748
20
740
791
947
999
684
857
888
792
951
995
936
928
868
648
999
991
857
852
843
868
20
911
880
927
983
662
955
900
955
927
919
747
...

output:

0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNOR...

result:

ok OK, worst = 0.605025 (500 test cases)

Test #32:

score: -100
Wrong Answer
time: 4ms
memory: 3688kb

input:

200
50
880
899
951
986
732
809
802
790
743
988
939
757
661
875
924
703
859
908
824
885
881
905
975
969
925
670
898
625
719
992
728
845
951
671
823
917
864
578
775
921
822
548
789
704
971
951
966
657
696
540
50
997
911
952
922
627
614
976
985
998
969
768
939
747
931
519
871
825
958
963
867
970
722
90...

output:

0
TAKE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGNORE
0
IGN...

result:

wrong output format Unexpected end of file - int32 expected (test case 28)