페이지를 불러오는 중…
해결한 사람
1
명
정답률
100.00
%
시간 제한
2000
ms
메모리 제한
2048
MB
Alicia and Beatriz are preparing a magic trick for the IOI Talent Show. The trick works as follows:
Your task is to devise and implement a strategy for Alicia and Beatriz. The more impressive the trick, the better your score: the objective is to maximize , the number of hidden cards Beatriz can correctly reveal.
The first procedure that you have to implement:
std::vector<int> Alicia(std::vector<int> P)
This procedure should return an array of length , representing the card flips Alicia performs. For each index (), the values in must be set as follows:
The second procedure that you have to implement:
std::vector<int> Beatriz(std::vector<int> Q)
Alicia. This array specifies the configuration of the cards when Beatriz enters.This procedure should return an array of length , representing the original permutation , that is, should hold for each ().
In each test case, the two procedures are called exactly once, as follows:
During the first run of the program:
Alicia is called with the original permutation .
For the array returned by Alicia:
Wrong Answer verdict.During the second run of the program:
Beatriz is called with the array .Let be the minimum value of for which your solution successfully performs the trick across all test cases.
In particular, a full score is achieved if .
Consider a scenario where and . The procedure Alicia is called as:
Alicia([2, 4, 3, 1, 5, 6])
Suppose Alicia uses the following strategy: flip every card such that . In this case, the condition holds for, and . Hence, the procedure returns the array .
Now, the procedure Beatriz is called as:
Beatriz([2, 4, -1, 1, -1, -1])
Knowing the strategy of Alice, she finds and returns the original array .
In this case, , as three cards were flipped. However, if submitted, this strategy would receive a score of , because there exist permutations where no index satisfies .
Note that this example does not satisfy the constraint and therefore will not be used during grading. The downloadable attachment for this task includes a sample input for the grader with . The same permutation is used in Subtask 0 during evaluation.
Input format:
N
P[0] P[1] ... P[N-1]
Output format:
S
Q[0] Q[1] ... Q[S-1]
T
B[0] B[1] ... B[T-1]
Here:
Alicia.Beatriz.Note that while holds for all testcases in this task, you may use the sample grader with any value of .
N
P[0] P[1] ... P[N-1]
S
Q[0] Q[1] ... Q[S-1]
T
B[0] B[1] ... B[T-1]
Here:
Alicia.Beatriz.Note that while holds for all testcases in this task, you may use the sample grader with any value of .
256
130 250 211 91 177 154 254 70 204 218 50 60 173 59 73 45 2 68 74 160 119 215 152 253 52 145 39 9 186 135 17 58 51 230 5 242 88 146 21 18 234 228 233 41 216 180 214 133 183 80 13 129 131 115 231 208 19 106 150 26 246 229 167 125 157 54 121 87 190 169 27 105 94 163 7 44 92 97 49 75 148 123 188 67 232 219 223 4 224 221 118 255 165 194 189 182 225 107 117 78 210 100 34 82 209 103 20 114 124 161 191 65 1 139 245 43 42 197 71 8 12 111 241 240 55 31 46 108 144 227 83 212 155 149 11 57 76 29 164 116 30 236 120 126 198 66 251 207 32 84 33 222 99 252 184 196 179 85 24 77 172 203 23 22 151 89 69 168 122 15 90 132 138 185 95 243 72 61 178 56 110 153 137 195 244 199 96 109 37 104 206 47 62 239 36 249 176 102 14 3 238 248 81 63 200 143 93 48 174 64 79 127 205 175 16 6 213 217 112 98 136 25 256 170 166 53 162 86 187 181 193 128 40 113 134 101 220 237 141 201 38 142 235 159 140 147 171 10 247 28 158 35 202 192 156 226
256
130 250 211 91 177 154 254 70 204 218 50 60 173 59 73 45 2 68 74 160 119 215 152 253 52 145 39 9 186 135 17 58 51 230 5 242 88 146 21 18 234 228 233 41 216 180 214 133 183 80 13 129 131 115 231 208 19 106 150 26 246 229 167 125 157 54 121 87 190 169 27 105 94 163 7 44 92 97 49 75 148 123 188 67 232 219 223 4 224 221 118 255 165 194 189 182 225 107 117 78 210 100 34 82 209 103 20 114 124 161 191 65 1 139 245 43 42 197 71 8 12 111 241 240 55 31 46 108 144 227 83 212 155 149 11 57 76 29 164 116 30 236 120 126 198 66 251 207 32 84 33 222 99 252 184 196 179 85 24 77 172 203 23 22 151 89 69 -1 122 15 90 132 138 185 95 243 72 61 178 56 110 153 137 195 244 199 96 109 37 104 206 47 62 239 36 249 176 102 14 3 238 248 81 63 200 143 93 48 174 64 79 127 205 175 16 6 213 217 112 98 136 25 256 170 166 53 162 86 187 181 193 128 40 113 134 101 220 237 141 201 38 142 235 159 140 147 171 10 247 28 158 35 202 192 156 226
256
130 250 211 91 177 154 254 70 204 218 50 60 173 59 73 45 2 68 74 160 119 215 152 253 52 145 39 9 186 135 17 58 51 230 5 242 88 146 21 18 234 228 233 41 216 180 214 133 183 80 13 129 131 115 231 208 19 106 150 26 246 229 167 125 157 54 121 87 190 169 27 105 94 163 7 44 92 97 49 75 148 123 188 67 232 219 223 4 224 221 118 255 165 194 189 182 225 107 117 78 210 100 34 82 209 103 20 114 124 161 191 65 1 139 245 43 42 197 71 8 12 111 241 240 55 31 46 108 144 227 83 212 155 149 11 57 76 29 164 116 30 236 120 126 198 66 251 207 32 84 33 222 99 252 184 196 179 85 24 77 172 203 23 22 151 89 69 168 122 15 90 132 138 185 95 243 72 61 178 56 110 153 137 195 244 199 96 109 37 104 206 47 62 239 36 249 176 102 14 3 238 248 81 63 200 143 93 48 174 64 79 127 205 175 16 6 213 217 112 98 136 25 256 170 166 53 162 86 187 181 193 128 40 113 134 101 220 237 141 201 38 142 235 159 140 147 171 10 247 28 158 35 202 192 156 226
International Olympiad in Informatics (IOI) 2025, official task package; Korean translation by Reporch.
Reporch에서 한국어 번역, 수식 표기, 이미지 호스팅 및 형식을 수정했습니다.
로그인 상태를 확인하는 중입니다.