QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#654819#9178. All-You-Can-Eatwoodie_0064#WA 22ms3844kbC++201.5kb2024-10-18 22:23:172024-10-18 22:23:17

Judging History

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

  • [2024-10-18 22:23:17]
  • 评测
  • 测评结果:WA
  • 用时:22ms
  • 内存:3844kb
  • [2024-10-18 22:23:17]
  • 提交

answer

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int N = 1e5 + 3;
int T;
int n, num;


void work(){
	cin >> n;
	int p = 0; vector<int> cake(n+1);
	vector<int> have; int s = 0, big = 0, idd = 0;
	for(int i = 1; i <= n; ++i){
		cin >> cake[i];
		if(p){
			cout << "0\nIGNORE\n" << flush;
			continue;
		}
		if(cake[i] >= 600){
			cout << have.size() + (idd != 0);
			for(auto x : have) cout << " " << x ;
			if(idd) cout << " " << big;
			cout << "\nTAKE\n" << flush; 
			p = 1;
			continue;
		}else if(cake[i] <= 400){
			cout << "0\nTAKE\n" << flush;
			s += cake[i];
			have.push_back(i);
		}else{
			if(big){
				if(cake[i] + big <= 1000){
					cout << have.size();
					for(auto x : have) cout << " " << x ;
					cout << "\nTAKE\n" << flush; 
					p = 1;
					continue;
				}
				if(cake[i] < big){
					cout << "1 " << idd << "\nTAKE\n" << flush;
					s = s - big + cake[i], idd = i;
					big = cake[i];
				}else{
					cout << "0\nIGNORE\n" << flush;
				}
			}else{
				big = cake[i], s += cake[i], idd = i;
				vector<int> erasse;
				while(s > 1000){
					s -= cake[have.back()];
					erasse.push_back(have.back());
					have.pop_back();
				}
				cout << erasse.size();
				for(auto x : erasse) cout << " " << x;
				cout << "\nTAKE\n" << flush;	
			}
		}	
		if(s >= 600)	p = 1;		
	}
}


int main(){
//	freopen("test.txt", "r", stdin);
//	ios::sync_with_stdio(false);
//	cin.tie(0);
	int T = 1;
	cin >> T;
	while(T--){
		work();
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3644kb

input:

1
5
10
13
450
585
465

output:

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

result:

ok OK, worst = 0.975480 (1 test case)

Test #2:

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

input:

1
1
100

output:

0
TAKE

result:

ok OK, worst = 1.000000 (1 test case)

Test #3:

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

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
IGNORE
0
IGNORE
1 1
TAKE
0
IGNORE...

result:

ok OK, worst = 0.836394 (2000 test cases)

Test #4:

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

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
TAKE
0
IGNORE
0
IGNORE
1 11
T...

result:

ok OK, worst = 0.836394 (500 test cases)

Test #5:

score: 0
Accepted
time: 22ms
memory: 3816kb

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
IGNORE
0
IGNORE
0
IGNORE
0
IG...

result:

ok OK, worst = 0.836394 (200 test cases)

Test #6:

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

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
IGNORE
0
IGNORE
0
IGNORE
0
IG...

result:

ok OK, worst = 0.836394 (100 test cases)

Test #7:

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

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
IGNORE
0
IGNORE
0
IGNORE
0
IG...

result:

ok OK, worst = 0.836394 (10 test cases)

Test #8:

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

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
IGNORE
0
IGNORE
0
IGNORE
0
IG...

result:

ok OK, worst = 0.836394 (1 test case)

Test #9:

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

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: 0ms
memory: 3560kb

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
0
TAKE
1 1
TAKE
0
TAKE
0...

result:

ok OK, worst = 0.600000 (100 test cases)

Test #11:

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

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
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE
0
TAKE...

result:

ok OK, worst = 0.996000 (41 test cases)

Test #12:

score: -100
Wrong Answer
time: 1ms
memory: 3836kb

input:

2000
5
174
966
564
649
8
5
58
211
929
70
340
5
481
864

output:

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

result:

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