QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#667460#5362. I'm always close to youucup-team4645100 ✓48ms94044kbC++2318.8kb2024-10-22 23:14:072024-10-22 23:14:17

详细

Subtask #1:

score: 100
Accepted

Test #1:

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

input:

2000 0
push-front a
push-front b
push-front a
push-back a
push-back a
push-front a
push-front a
push-back a
push-front a
push-back b
push-back a
push-back b
push-front b
push-front b
push-front a
push-back b
push-front b
push-front b
push-back b
push-back a
push-front a
push-back a
push-front b
push...

output:

1
3
5
8
11
15
19
24
29
34
39
49
55
68
81
94
107
122
139
156
173
191
209
228
248
268
291
316
338
364
387
416
445
475
505
535
565
599
634
669
705
741
777
815
852
892
930
971
1010
1052
1094
1135
1178
1220
1271
1322
1373
1425
1479
1532
1587
1642
1698
1754
1812
1875
1938
1997
2063
2129
2195
2263
2331
239...

result:

ok 2000 lines

Test #2:

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

input:

2000 0
push-back b
push-front b
push-back a
push-back b
push-back a
push-front b
push-back a
push-front a
push-front b
push-back b
push-back a
push-back b
push-back b
push-back a
push-front a
push-back a
push-front a
push-back a
push-front b
push-back b
push-back b
push-back b
push-front a
push-fron...

output:

1
2
5
8
11
15
21
27
33
41
49
58
67
78
88
101
112
128
140
157
175
193
208
228
249
272
296
320
345
371
398
425
454
484
514
546
577
611
646
681
717
754
793
831
871
913
955
997
1041
1085
1130
1175
1221
1267
1313
1362
1412
1465
1516
1571
1627
1683
1739
1798
1858
1918
1978
2041
2102
2163
2229
2296
2364
24...

result:

ok 2000 lines

Subtask #2:

score: 100
Accepted

Test #3:

score: 100
Accepted
time: 36ms
memory: 61360kb

input:

200000 0
push-back m
push-front x
push-front y
push-front e
push-back l
push-back c
push-front y
push-back n
push-front q
push-back w
push-back k
push-back f
push-back c
push-front j
push-front h
push-back y
push-back w
push-front k
push-back b
push-front f
push-back e
push-front v
push-back x
push-...

output:

1
3
6
10
15
21
27
35
44
54
65
77
89
103
118
133
149
166
185
204
224
246
268
292
316
342
369
396
425
455
485
517
549
582
616
651
687
724
762
801
841
883
926
969
1012
1057
1103
1151
1199
1248
1298
1349
1401
1453
1507
1562
1617
1674
1732
1791
1851
1912
1974
2036
2100
2165
2231
2297
2365
2434
2503
2574
...

result:

ok 200000 lines

Test #4:

score: 100
Accepted
time: 35ms
memory: 61096kb

input:

200000 0
push-back u
push-back b
push-back y
push-front w
push-back j
push-back n
push-back s
push-front d
push-back x
push-front s
push-back a
push-front r
push-front a
push-front d
push-front v
push-back b
push-front n
push-front l
push-back j
push-back i
push-front z
push-back a
push-back e
push-...

output:

1
3
6
10
15
21
28
36
45
54
65
77
89
102
117
132
148
166
184
204
225
246
269
293
317
343
370
397
426
454
484
515
547
580
614
649
685
722
760
800
840
882
924
967
1011
1057
1103
1150
1198
1247
1297
1348
1400
1453
1507
1562
1619
1676
1734
1793
1854
1915
1977
2040
2104
2169
2235
2301
2369
2438
2508
2579
...

result:

ok 200000 lines

Test #5:

score: 100
Accepted
time: 46ms
memory: 62292kb

input:

200000 0
push-front o
push-back l
push-front z
push-front m
push-back v
push-front k
push-front i
push-back t
push-back q
push-front k
push-back u
push-back l
push-back z
push-back e
push-back d
push-back i
push-front y
push-back q
push-front m
push-back p
push-back s
push-back t
push-front v
push-b...

output:

1
3
6
10
15
21
28
36
45
54
65
76
88
102
117
132
149
166
184
204
225
246
268
292
316
342
368
395
422
451
479
510
543
576
610
646
682
719
757
796
836
877
920
963
1007
1052
1098
1145
1194
1243
1293
1345
1397
1450
1505
1560
1616
1673
1731
1791
1851
1912
1974
2037
2101
2166
2232
2299
2367
2436
2507
2578
...

result:

ok 200000 lines

Subtask #3:

score: 100
Accepted

Dependency #1:

100%
Accepted

Test #6:

score: 100
Accepted
time: 41ms
memory: 94044kb

input:

200000 0
push-back b
push-back b
push-front c
push-back b
push-front c
push-front a
push-front c
push-back c
push-back c
push-front c
push-back a
push-back c
push-front c
push-back b
push-front c
push-back b
push-front c
push-back c
push-back b
push-front b
push-back a
push-front a
push-front c
push...

output:

1
2
5
7
11
17
23
30
37
45
53
61
72
84
96
109
122
137
154
171
191
212
233
254
277
300
323
347
373
399
429
459
490
522
555
588
621
654
687
725
763
803
844
881
923
966
1009
1053
1099
1145
1193
1242
1291
1341
1391
1441
1493
1548
1601
1657
1716
1775
1834
1896
1956
2020
2083
2147
2212
2279
2346
2414
2484
...

result:

ok 200000 lines

Test #7:

score: 100
Accepted
time: 48ms
memory: 92176kb

input:

200000 0
push-back a
push-front b
push-back a
push-front c
push-front a
push-front b
push-front b
push-front a
push-front b
push-front c
push-back b
push-front c
push-back b
push-front b
push-front c
push-front c
push-back a
push-back a
push-back b
push-back a
push-back c
push-back b
push-back b
pus...

output:

1
3
5
9
13
17
23
30
37
44
53
64
74
87
100
113
126
141
156
174
192
210
231
253
274
295
320
345
371
399
426
453
483
513
545
578
612
647
682
718
754
790
832
874
917
960
1004
1049
1094
1139
1186
1235
1284
1334
1385
1438
1493
1547
1604
1661
1720
1780
1840
1900
1961
2023
2085
2148
2211
2278
2342
2410
2479...

result:

ok 200000 lines

Test #8:

score: 100
Accepted
time: 29ms
memory: 92528kb

input:

200000 0
push-back b
push-front a
push-back b
push-back b
push-front a
push-back b
push-front c
push-front a
push-back c
push-back b
push-front c
push-front b
push-front a
push-front b
push-front c
push-back c
push-front a
push-back a
push-back a
push-back a
push-front c
push-back c
push-front c
pus...

output:

1
3
5
7
11
14
21
28
36
45
54
64
75
88
101
115
130
145
161
179
197
217
239
261
283
306
330
356
382
409
437
467
497
527
558
589
622
655
691
729
768
807
846
888
930
971
1016
1061
1106
1153
1201
1250
1299
1350
1401
1452
1505
1558
1612
1666
1721
1776
1834
1892
1954
2017
2080
2144
2208
2275
2342
2410
2478...

result:

ok 200000 lines

Test #9:

score: 100
Accepted
time: 23ms
memory: 59868kb

input:

200000 0
push-back a
push-front a
push-front a
push-front a
push-back a
push-back a
push-front a
push-back a
push-front a
push-front a
push-back a
push-front a
push-back a
push-front a
push-back a
push-front a
push-back a
push-back a
push-back a
push-back a
push-front a
push-front a
push-back a
push...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 200000 lines

Test #10:

score: 100
Accepted
time: 21ms
memory: 71136kb

input:

200000 0
push-back a
push-front b
push-back b
push-front a
push-front b
push-front a
push-back a
push-front b
push-front a
push-back b
push-back a
push-front b
push-front a
push-back b
push-front b
push-front a
push-back a
push-front b
push-back b
push-back a
push-back b
push-front a
push-front b
pu...

output:

1
3
5
7
9
11
13
15
17
19
21
23
25
27
29
31
33
35
37
39
41
43
45
47
49
51
53
55
57
59
61
63
65
67
69
71
73
75
77
79
81
83
85
87
89
91
93
95
97
99
101
103
105
107
109
111
113
115
117
119
121
123
125
127
129
131
133
135
137
139
141
143
145
147
149
151
153
155
157
159
161
163
165
167
169
171
173
175
177...

result:

ok 200000 lines

Test #11:

score: 100
Accepted
time: 20ms
memory: 93572kb

input:

200000 0
push-back a
push-front a
push-back a
push-back a
push-front a
push-front a
push-back a
push-back a
push-back a
push-front a
push-back a
push-back a
push-back a
push-back a
push-back a
push-back a
push-front a
push-front a
push-front a
push-back a
push-front a
push-front a
push-front a
push-...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
77
116
119
122
163
167
209
214
257
300
343
386
429
439
449
494
539
584
597
610
657
704
719
767
783
799
849
866
883
935
987
1006
1059
1079
1133
1187
1209
1231
1253
1310
1333
1356
1415
1474
1499
15...

result:

ok 200000 lines

Test #12:

score: 100
Accepted
time: 15ms
memory: 64028kb

input:

200000 0
push-back f
push-back f
push-front f
push-back f
push-front f
push-front f
push-back f
push-front f
push-front f
push-back f
push-front f
push-front f
push-front f
push-front f
push-front f
push-front f
push-front f
push-back f
push-back f
push-back f
push-front f
push-front f
push-back f
p...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 200000 lines

Subtask #4:

score: 100
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #13:

score: 100
Accepted
time: 42ms
memory: 91072kb

input:

200000 1
push-back a
push-front a
push-front z
push-back w
push-back s
push-back q
push-back j
push-front e
push-back y
push-back r
push-front h
push-back a
push-back t
push-back h
push-back z
push-back k
push-back w
push-front g
push-front q
push-back a
push-front i
push-back q
push-back x
push-fro...

output:

1
3
6
9
12
17
23
29
37
45
53
61
71
81
94
108
124
140
157
174
192
212
233
255
277
300
324
348
374
403
432
461
490
521
552
584
618
652
688
723
761
801
840
882
924
966
1010
1053
1097
1141
1188
1233
1281
1332
1379
1430
1484
1538
1591
1648
1705
1763
1821
1883
1945
2008
2071
2135
2201
2268
2335
2404
2473
...

result:

ok 200000 lines

Test #14:

score: 100
Accepted
time: 44ms
memory: 91248kb

input:

200000 1
push-back b
push-back a
push-front y
push-front v
push-back t
push-back r
push-front j
push-back g
push-front y
push-front r
push-back h
push-back y
push-back n
push-back c
push-front r
push-front f
push-front p
push-front b
push-back k
push-front v
push-back e
push-back j
push-front s
push...

output:

1
2
5
8
11
17
22
29
37
46
55
65
76
87
101
116
131
147
163
180
199
218
239
259
281
302
325
350
375
401
429
457
487
519
552
586
621
656
691
729
767
805
845
886
929
971
1014
1059
1105
1152
1200
1249
1299
1350
1401
1453
1505
1559
1614
1669
1726
1785
1844
1904
1964
2026
2088
2150
2217
2282
2347
2416
2482...

result:

ok 200000 lines

Test #15:

score: 100
Accepted
time: 29ms
memory: 60480kb

input:

200000 1
push-back a
push-front z
push-front y
push-front x
push-back w
push-back v
push-front u
push-back t
push-front s
push-front r
push-back q
push-front p
push-back o
push-front n
push-back m
push-front l
push-back k
push-back j
push-back i
push-back h
push-front g
push-front f
push-back e
push...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 200000 lines

Test #16:

score: 100
Accepted
time: 26ms
memory: 69632kb

input:

200000 1
push-back a
push-front a
push-back y
push-front v
push-front u
push-front r
push-back p
push-front o
push-front l
push-back k
push-back h
push-front g
push-front d
push-back c
push-front a
push-front x
push-back v
push-front u
push-back s
push-back p
push-back o
push-front l
push-front k
pu...

output:

1
3
5
7
9
11
13
15
17
19
21
23
25
27
29
31
33
35
37
39
41
43
45
47
49
51
53
55
57
59
61
63
65
67
69
71
73
75
77
79
81
83
85
87
89
91
93
95
97
99
101
103
105
107
109
111
113
115
117
119
121
123
125
127
129
131
133
135
137
139
141
143
145
147
149
151
153
155
157
159
161
163
165
167
169
171
173
175
177...

result:

ok 200000 lines

Test #17:

score: 100
Accepted
time: 24ms
memory: 92484kb

input:

200000 1
push-back a
push-front z
push-back y
push-back x
push-front w
push-front v
push-back u
push-back t
push-back s
push-front r
push-back q
push-back p
push-back o
push-back n
push-back m
push-back l
push-front k
push-front j
push-front i
push-back h
push-front g
push-front f
push-front e
push-...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
77
116
119
122
163
167
209
214
257
300
343
386
429
439
449
494
539
584
597
610
657
704
719
767
783
799
849
866
883
935
987
1006
1059
1079
1133
1187
1209
1231
1253
1310
1333
1356
1415
1474
1499
15...

result:

ok 200000 lines

Test #18:

score: 100
Accepted
time: 21ms
memory: 64004kb

input:

200000 1
push-back f
push-back e
push-front d
push-back c
push-front b
push-front a
push-back z
push-front y
push-front x
push-back w
push-front v
push-front u
push-front t
push-front s
push-front r
push-front q
push-front p
push-back o
push-back n
push-back m
push-front l
push-front k
push-back j
p...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 200000 lines