QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#254063#1338. Permutation SortMaMengQiAC ✓1ms3840kbC++202.6kb2023-11-17 23:34:032023-11-17 23:34:03

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

6
2 3 1 4 5 6
3 1 2 5 4 6

output:

4

result:

ok answer is '4'

Test #2:

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

input:

6
1 2 3 4 5 6
3 1 2 5 4 6

output:

0

result:

ok answer is '0'

Test #3:

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

input:

6
2 3 1 4 5 6
3 4 5 6 1 2

output:

-1

result:

ok answer is '-1'

Test #4:

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

input:

196
174 55 172 129 5 107 62 124 43 168 46 45 16 19 125 72 69 84 170 26 180 103 23 108 146 20 191 15 104 22 1 68 194 34 24 85 79 165 38 57 171 18 9 81 40 123 177 182 131 88 110 128 120 105 184 96 142 2 154 52 61 161 75 51 111 135 157 6 8 160 162 114 70 173 139 186 179 47 116 11 159 82 76 127 36 64 54...

output:

-1

result:

ok answer is '-1'

Test #5:

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

input:

198
134 52 142 36 39 30 188 2 189 191 32 147 178 6 179 117 40 120 138 137 177 118 190 13 68 91 108 95 112 14 135 66 156 31 136 102 88 186 192 132 184 33 121 22 35 3 43 96 27 110 101 8 124 67 59 128 183 197 107 38 150 194 163 146 133 11 151 82 89 94 19 23 29 139 20 153 173 37 87 16 85 25 169 149 182 ...

output:

2

result:

ok answer is '2'

Test #6:

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

input:

200
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 ...

output:

0

result:

ok answer is '0'

Test #7:

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

input:

185
138 21 159 128 1 114 57 32 111 74 52 70 180 130 54 23 164 137 142 167 184 150 152 35 36 171 28 9 94 16 144 100 166 107 113 89 119 43 110 102 93 170 173 79 40 34 126 46 185 8 64 96 20 146 172 53 90 178 92 153 125 175 140 44 115 2 84 182 83 55 27 162 97 65 87 31 158 5 14 168 131 101 124 151 78 143...

output:

-1

result:

ok answer is '-1'

Test #8:

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

input:

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

output:

123456789

result:

ok answer is '123456789'

Test #9:

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

input:

198
158 151 70 4 11 98 7 8 62 10 178 114 13 168 19 12 17 18 41 120 54 22 180 27 72 26 74 126 123 30 31 32 34 110 35 36 37 38 39 40 15 176 43 44 45 66 102 131 58 1 51 142 181 152 49 56 47 55 132 194 198 81 188 63 65 164 28 68 69 163 122 154 137 24 165 76 2 78 79 80 9 14 20 84 85 117 29 136 89 90 145 ...

output:

-1

result:

ok answer is '-1'

Test #10:

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

input:

198
93 126 29 136 61 144 76 138 195 135 109 22 124 8 181 60 52 41 23 13 176 62 9 35 69 114 7 122 147 89 94 103 102 117 198 182 180 115 90 192 40 156 44 47 46 87 27 123 32 186 121 49 78 163 50 142 79 4 108 18 91 145 153 85 33 152 57 17 175 54 129 154 48 148 63 34 74 80 160 151 26 169 184 193 82 100 1...

output:

-1

result:

ok answer is '-1'

Test #11:

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

input:

200
148 67 9 79 24 109 173 130 86 28 45 11 63 34 85 40 113 106 3 122 140 112 5 165 175 84 184 153 75 91 128 43 30 107 131 83 19 38 53 50 55 177 160 190 95 104 149 48 118 139 172 192 90 176 10 23 44 61 110 96 150 151 115 152 65 164 87 82 60 46 66 154 98 146 89 37 189 186 88 187 141 178 185 174 194 11...

output:

12345678901234

result:

ok answer is '12345678901234'

Test #12:

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

input:

198
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 ...

output:

0

result:

ok answer is '0'

Test #13:

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

input:

198
145 45 179 118 80 53 132 81 172 48 160 54 186 87 109 115 39 144 6 123 88 170 36 56 1 24 3 70 163 127 27 95 165 198 38 126 11 5 168 194 108 196 86 63 67 44 66 13 189 151 122 76 117 131 98 101 111 97 85 4 60 34 139 69 55 18 134 72 183 94 82 21 195 96 7 10 74 93 180 84 65 33 23 73 110 79 135 107 10...

output:

3181

result:

ok answer is '3181'

Test #14:

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

input:

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

output:

232792559

result:

ok answer is '232792559'

Test #15:

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

input:

200
16 20 43 25 29 94 120 34 99 42 194 47 85 11 98 156 149 154 197 166 7 165 27 55 24 122 9 28 6 4 124 56 88 45 59 103 8 37 170 116 123 50 159 174 69 187 90 76 121 66 161 198 162 136 119 153 53 13 112 77 110 129 78 49 17 163 200 58 22 30 195 52 71 199 189 35 180 102 91 80 48 185 142 193 164 147 51 8...

output:

-1

result:

ok answer is '-1'

Test #16:

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

input:

200
171 2 48 4 5 6 7 8 43 10 11 12 13 74 16 91 17 18 71 34 21 102 188 24 25 33 27 28 29 30 186 82 23 145 15 36 37 38 39 40 41 109 80 44 45 46 47 70 49 50 22 3 53 54 55 62 57 58 59 60 61 135 137 127 65 66 67 32 69 26 79 72 73 9 63 75 14 78 56 76 81 1 83 84 85 86 87 124 89 167 88 92 93 94 139 96 97 98...

output:

58

result:

ok answer is '58'

Test #17:

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

input:

198
41 180 126 125 108 39 65 123 69 107 157 198 49 40 147 1 179 113 102 172 152 178 57 19 64 5 16 72 84 166 110 162 146 163 118 34 48 66 67 176 76 50 8 185 106 38 128 122 151 9 95 21 173 141 36 42 129 136 116 192 53 23 168 134 100 75 15 111 96 56 87 68 22 71 74 187 117 86 159 190 156 196 194 115 81 ...

output:

2722

result:

ok answer is '2722'

Test #18:

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

input:

200
139 110 185 180 126 40 165 148 5 56 69 55 76 116 57 198 174 170 86 47 35 9 79 111 75 187 130 39 172 127 168 101 53 118 97 159 182 112 4 42 196 68 82 142 41 135 34 91 62 1 136 104 176 147 51 27 29 128 132 175 158 65 92 133 31 38 115 199 49 164 48 44 7 190 54 59 15 109 30 194 145 195 144 22 117 12...

output:

24067258815599

result:

ok answer is '24067258815599'

Test #19:

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

input:

200
138 68 51 79 167 134 63 20 186 77 7 95 155 157 115 32 112 46 21 196 139 150 199 117 64 67 163 169 181 121 158 105 193 29 184 106 188 185 43 89 182 52 57 113 18 133 55 56 25 98 3 145 151 141 103 146 85 118 36 142 161 94 76 72 109 93 156 183 197 22 189 24 28 60 114 44 54 191 81 41 82 27 58 100 10 ...

output:

-1

result:

ok answer is '-1'

Test #20:

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

input:

197
43 170 148 136 171 146 44 122 157 78 144 160 60 165 110 3 117 187 125 182 153 20 131 55 68 162 66 14 58 91 2 10 115 128 95 191 135 96 93 35 147 138 155 98 56 1 9 33 181 178 119 90 40 61 143 174 50 18 72 184 151 94 48 173 175 145 88 7 52 6 101 105 46 120 113 194 74 70 53 54 154 150 39 172 114 118...

output:

-1

result:

ok answer is '-1'

Test #21:

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

input:

200
110 2 14 4 19 196 85 125 184 189 71 168 13 35 90 16 17 18 130 6 7 60 100 3 25 147 51 20 29 30 31 32 39 145 181 80 37 84 47 40 192 33 43 44 45 144 11 73 186 166 72 94 123 155 55 56 57 177 59 83 61 62 48 64 102 66 67 68 134 132 50 99 54 74 75 76 81 78 153 65 141 82 105 28 195 86 91 88 183 27 187 9...

output:

128

result:

ok answer is '128'

Test #22:

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

input:

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

output:

-1

result:

ok answer is '-1'

Test #23:

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

input:

200
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 ...

output:

0

result:

ok answer is '0'

Test #24:

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

input:

190
144 27 83 168 30 130 12 107 102 103 22 69 181 105 183 65 128 179 133 165 66 3 138 161 48 20 148 173 35 169 166 74 155 164 116 99 73 29 178 180 157 182 54 118 163 151 42 137 41 100 184 126 171 112 72 84 2 135 77 121 132 108 139 117 177 33 80 88 68 104 175 96 62 53 98 110 28 82 174 176 92 76 159 5...

output:

-1

result:

ok answer is '-1'

Test #25:

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

input:

197
90 43 132 123 175 146 10 115 38 57 78 48 65 11 100 5 74 59 67 195 137 30 40 113 51 104 88 97 82 141 193 22 129 55 172 162 8 19 27 181 37 149 105 176 62 136 87 158 21 114 83 179 39 45 178 86 173 154 32 194 174 118 106 152 111 35 165 120 144 126 112 128 63 153 142 53 184 108 49 54 4 24 151 156 91 ...

output:

173

result:

ok answer is '173'

Test #26:

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

input:

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

output:

1

result:

ok answer is '1'

Test #27:

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

input:

200
129 91 48 118 23 8 185 110 196 39 117 102 65 86 177 197 72 18 199 7 3 97 82 139 133 26 51 28 115 124 14 108 109 21 13 127 37 59 100 149 87 78 132 44 167 66 16 54 73 50 192 144 38 180 119 99 92 107 120 80 5 15 57 162 190 138 89 194 154 95 90 147 85 101 155 142 77 182 145 24 1 179 58 69 46 137 116...

output:

348

result:

ok answer is '348'

Test #28:

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

input:

200
46 144 79 84 36 82 42 64 25 74 146 63 122 152 93 106 156 69 43 149 185 49 103 73 28 168 6 105 87 96 112 101 104 177 32 113 138 191 134 183 10 70 90 83 110 29 39 14 145 71 119 9 67 92 35 184 178 164 131 151 18 66 200 169 116 133 173 77 76 50 12 189 160 61 17 127 158 180 59 188 47 11 22 88 161 165...

output:

17190899153999

result:

ok answer is '17190899153999'

Test #29:

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

input:

200
62 198 195 184 128 134 167 119 16 180 71 151 182 116 157 55 36 150 133 98 31 178 73 42 86 70 115 191 78 33 132 6 52 183 177 121 171 141 190 60 29 81 85 111 101 152 186 20 76 140 114 80 113 91 17 127 92 175 8 22 90 77 189 146 58 89 138 53 145 154 179 174 158 49 168 149 162 112 137 67 156 161 142 ...

output:

1

result:

ok answer is '1'

Test #30:

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

input:

196
26 39 97 41 127 27 16 124 78 164 67 187 44 119 57 150 195 179 178 107 43 115 122 145 49 120 166 37 63 61 88 24 190 109 6 101 34 5 129 96 77 152 170 48 174 113 128 95 75 153 180 173 46 134 53 25 143 161 130 146 4 79 23 160 100 105 14 72 30 132 76 68 110 3 142 60 189 7 139 92 13 56 22 165 9 17 55 ...

output:

-1

result:

ok answer is '-1'

Test #31:

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

input:

200
194 164 140 182 77 23 90 133 130 200 165 9 58 20 65 123 107 105 21 80 156 183 124 151 70 87 131 95 51 180 179 59 166 17 26 101 52 82 60 155 104 75 118 49 103 83 69 22 92 24 141 72 56 122 63 93 98 106 127 178 33 85 41 48 191 62 89 13 159 145 153 2 199 78 67 25 19 50 6 109 148 181 177 45 47 121 12...

output:

2119249

result:

ok answer is '2119249'

Test #32:

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

input:

200
170 8 135 28 121 141 2 12 6 106 176 59 77 11 15 90 33 38 171 104 166 45 84 74 138 172 5 156 190 163 194 148 10 193 145 115 122 67 184 9 43 150 66 71 116 53 75 197 4 117 39 18 26 88 175 124 111 187 89 70 181 136 98 167 96 144 62 169 105 130 23 189 191 61 64 107 198 76 110 20 112 180 34 14 81 13 4...

output:

45517

result:

ok answer is '45517'

Test #33:

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

input:

1
1
1

output:

0

result:

ok answer is '0'

Test #34:

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

input:

124
54 27 17 2 45 107 8 106 117 16 33 93 113 105 84 29 81 123 78 100 66 12 121 75 53 77 24 108 116 3 44 94 83 97 67 59 101 51 7 86 104 39 40 28 5 70 85 76 18 25 112 79 95 46 72 124 96 102 60 103 61 15 71 11 22 13 122 73 58 118 119 38 56 36 68 110 82 23 111 63 50 64 43 42 120 115 57 31 52 6 30 48 47 ...

output:

6299

result:

ok answer is '6299'

Test #35:

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

input:

198
149 170 18 175 36 100 71 89 185 174 77 124 24 109 135 6 116 137 167 159 4 192 2 125 119 91 19 182 39 131 110 180 42 64 101 155 78 177 58 68 143 120 22 94 158 126 183 32 7 73 63 99 28 166 186 127 178 29 34 141 85 65 193 59 70 160 95 107 106 62 49 173 176 26 80 148 179 171 67 105 54 47 156 154 108...

output:

1

result:

ok answer is '1'

Test #36:

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

input:

2
2 1
1 2

output:

-1

result:

ok answer is '-1'