├── .gitignore ├── LICENSE ├── README.md ├── exercises ├── .gitkeep ├── week-0 │ ├── composer01.jpg │ ├── composer02.jpg │ ├── composer03.jpg │ ├── composer04.jpg │ ├── ex_0_en.ipynb │ ├── ex_0_ja.ipynb │ ├── ex_0_ko.ipynb │ ├── histogram01.jpg │ └── histogram02.jpg ├── week-1 │ ├── ex_1a_en.ipynb │ ├── ex_1a_ja.ipynb │ ├── ex_1a_ko.ipynb │ ├── ex_1b_en.ipynb │ ├── ex_1b_ja.ipynb │ ├── ex_1b_ko.ipynb │ ├── grover_algorithm.png │ ├── oracle.png │ ├── ryoko.png │ ├── step0.png │ ├── step1.png │ ├── step2.png │ ├── unstructured_search.png │ └── week-1 │ │ ├── ex_1a_en.ipynb │ │ ├── ex_1a_ja.ipynb │ │ ├── ex_1a_ko.ipynb │ │ ├── ex_1b_en.ipynb │ │ ├── ex_1b_ja.ipynb │ │ ├── ex_1b_ko.ipynb │ │ ├── grover_algorithm.png │ │ ├── oracle.png │ │ ├── ryoko.png │ │ ├── step0.png │ │ ├── step1.png │ │ ├── step2.png │ │ └── unstructured_search.png ├── week-2 │ ├── 4lightsout_ex.png │ ├── 4lightsout_pr.png │ ├── circuit_ex.png │ ├── ex_2a_en.ipynb │ ├── ex_2a_ja.ipynb │ ├── ex_2a_ko.ipynb │ ├── ex_2b_en.ipynb │ ├── ex_2b_ja.ipynb │ ├── ex_2b_ko.ipynb │ ├── gatesynthesis_ex.png │ ├── lights_out_prob.png │ └── lights_out_rule.png └── week-3 │ ├── asteroids_beam_example.png │ ├── asteroids_example.png │ ├── false_asteroids_example.png │ ├── final_en.ipynb │ ├── final_ja.ipynb │ ├── final_ko.ipynb │ └── ryoko.png ├── fig ├── ep1.png ├── ep2.png ├── ep3.png ├── ep4.png ├── ep5.png └── ep6.png ├── hints ├── hint_1a.pdf ├── hint_1b.pdf ├── hint_2a.pdf ├── hint_2a_nb │ ├── hint_2a_board.png │ ├── hint_2a_circuit.jpg │ ├── hint_2a_ex.ipynb │ ├── hint_2a_flip_tile.png │ └── hint_2a_flip_tile_circuit.png ├── hint_2b.pdf ├── hint_2b_nb │ └── Search QRAM Example.ipynb └── hint_3.pdf ├── quizzes ├── .gitkeep ├── quiz_1 │ ├── quantum_challenge_quiz_1.pdf │ └── quantum_challenge_quiz_1.pptx ├── quiz_2 │ ├── quantum_challenge_quiz_2.pdf │ └── quantum_challenge_quiz_2.pptx └── quiz_3 │ ├── quantum_challenge_quiz_3.pdf │ └── quantum_challenge_quiz_3.pptx ├── solutions ├── amatsuo.png ├── drteaching.jpg ├── leaderboard.md ├── snishio.png ├── tsatoh.png ├── week-1 │ ├── ex_1a_solutions_en.ipynb │ ├── ex_1a_solutions_ja.ipynb │ ├── ex_1b_solutions_en.ipynb │ ├── ex_1b_solutions_ja.ipynb │ └── participant solutions │ │ └── readme.txt ├── week-2 │ ├── ex_2a_solutions_en.ipynb │ ├── ex_2a_solutions_ja.ipynb │ ├── ex_2b_solutions_en.ipynb │ ├── ex_2b_solutions_ja.ipynb │ └── participant solutions │ │ └── readme.txt └── week-3 │ ├── Hint_3.png │ ├── OR_cover_edge.png │ ├── ex_3_overview.png │ ├── ex_3_solution_en.ipynb │ ├── ex_3_solution_ja.ipynb │ ├── final_circuit_1.png │ ├── final_circuit_2.png │ └── sample_problem_set.json └── submissions ├── FinalSolution(Ket.G).ipynb ├── IBM_QC_5124_Pulkit_Sinha.ipynb ├── readme.txt ├── writeup_Nagayoshi.ipynb ├── writeup_adsz.ipynb ├── writeup_burgholzer.ipynb ├── writeup_hillmich.ipynb ├── writeup_jarnicki.ipynb ├── writeup_jarnicki.pdf ├── writeup_joelms.html ├── writeup_joelms.ipynb ├── writeup_klukowski.ipynb ├── writeup_tulowiecki.ipynb └── writeup_tulowiecki.pdf /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | .ipynb_checkpoints/ 4 | 5 | .vscode/ 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # Welcome to IBM Quantum Challenge! 3 | 4 | [![License](https://img.shields.io/github/license/qiskit-community/IBMQuantumChallenge2020.svg)](https://opensource.org/licenses/Apache-2.0)![Last updated](https://img.shields.io/github/last-commit/qiskit-community/IBMQuantumChallenge2020/main?label=Last%20updated&style=flat) 5 | 6 | 7 | [日本語はこちら](#ibm-quantum-challengeへようこそ)
8 | [한글은 여기](#ibm-quantum-challenge환영합니다)
9 | 10 | ## Thank you! We have completed this challenge on Nov 30th, 2020. 11 | 12 | ## Leaderboard 13 | The [Leaderboard](./solutions/leaderboard.md) shows the top ten scores and standings of contestants who have submitted their code to the final exercise. 14 | 15 | ## How to Solve the Final Exercise 16 | [Sample solutions](./solutions/week-3/ex_3_solution_en.ipynb): Example solution to the final exercise with honorary mentions to the top three scorers by our judges. 17 | 18 | ## Top Scorers’ Solutions 19 | [Top Scorers’ Solutions](https://github.com/qiskit-community/IBMQuantumChallenge2020/tree/main/submissions): How did the top scorers tackle this problem? Check out their unique and excellent solutions. 20 | 21 | 22 | ## The Story behind IBM Quantum Chellenge 23 | You can explore each story behind the adventure of Dr. Ryoko. 24 | 25 | |[Episode 1](https://youtu.be/eLw7fWb2xv4) |[Episode 2](https://youtu.be/f8TEd_51rHI) |[Episode 3](https://youtu.be/kLizHnvTguE)|[Episode 4](https://youtu.be/25PcR5Pn4hk) | [Episode 5](https://youtu.be/Bkk5-j6rpoM) |[Episode 6](https://youtu.be/EC2Dc1QgLZY) | 26 | | --- | --- | --- | --- | --- | --- | 27 | | ![image of ep1](./fig/ep1.png) | ![image of ep2](./fig/ep2.png) | ![image of ep3](./fig/ep3.png) | ![image of ep4](./fig/ep4.png) | ![image of ep5](./fig/ep5.png) | ![image of ep6](./fig/ep6.png) | 28 |
29 | 30 | ## IMPORTANT : [Final exercise submission rules](#final-exercise-submission-rules) 31 | 32 | 33 | ## Hello, quantum world. 34 | 35 | As we approach the end of 2020, we would like to engage the community with new exciting set of challenges, and further push limits of our quantum systems to achieve another yet significant milestone.  36 | 37 | Our first competitive coding contest [IBM Quantum Challenge](https://ibmquantum.angelhack.com/) was held in November 2019, attracting both seasoned coders and newbies from all over the world to start their journey in Quantum Computing. 38 | In May 2020, we celebrated our fourth anniversary of IBM Quantum Experience with another Challenge where 1,745 people from 45 countries came together to solve four problems making total use of the 18 IBM Quantum systems on the IBM Cloud exceeding 1 billion circuits a day.  39 | 40 | Starting Nov 9th at 9am JST, we present you with three weeks of new challenges that will help grow your knowledge, skills, and understanding of quantum computing and Qiskit to tackle problems using some well-known quantum algorithms. 41 | 42 | In recognition of your participation, we are awarding digital badges to those who complete all exercises. 43 | 44 | Note that participation is allowed for those who have applied and received official confirmation from the challenge organizers only.  45 | 46 | ## Programming Environment 47 | IBM Quantum Challenge will be hosted on IBM Quantum Experience (a.k.a. IQX). IQX allows you to build, execute and evaluate your quantum circuits within a self-contained Jupyter notebook environment without downloading anything to your computer. 48 | 49 | On Nov 9, 2020 when the challenge site opens, participants will see a set of exercises hosted in this self-contained Jupyter notebook environment where you can write and run your code directly from and make submissions of your answers. 50 | 51 | Please note that the challenge site with exercises hosted in this Jupyter notebook environment is only accessible by applicants who confirmed participation upon receiving a confirmation email from the event organizers. 52 | 53 | ## Preparation 54 | In many cases, you may prefer to run your code locally when working on the exercises before you make your submission in the IBM Quantum Experience environment. In such case, you will need to install **Qiskit** to your computer. Qiskit is a Python based opensource framework for working with quantum computers at the level of pulses, circuits, and algorithms. Please see the [Qiskit.org](https://qiskit.org) page for more details. 55 | 56 | Qiskit can be installed by using *pip*: 57 | 58 | ``` 59 | $ pip install qiskit 60 | ``` 61 | 62 | Please check out [Install Qiskit](https://qiskit.org/documentation/install.html) or [YouTube video](https://www.youtube.com/watch?v=M4EkW4VwhcI) for a step by step installaion guide. 63 | 64 | ## Challenge Index 65 | The challenge content has been shared with the public on the following dates.
66 | 67 | | Week | Challenge | Message from Dr. Ryoko | Available on (JST) | 68 | | --- | --- | --- | --- | 69 | | Week 0 |[For Beginners: The atoms of computation](exercises/week-0/ex_0_en.ipynb) | [Episode 1](https://youtu.be/eLw7fWb2xv4) |Now Live | 70 | | Week 1 |[Learning Challenge Exercise I-A](https://github.com/qiskit-community/IBMQuantumChallenge2020/blob/iqx/exercises/week-1/ex_1a_en.ipynb)
[Learning Challenge Exercise I-B](https://github.com/qiskit-community/IBMQuantumChallenge2020/blob/iqx/exercises/week-1/ex_1b_en.ipynb)| [Episode 2](https://youtu.be/f8TEd_51rHI) | Nov 9th 2020 | 71 | | Week 2 |[Learning Challenge Exercise II-A](https://github.com/qiskit-community/IBMQuantumChallenge2020/blob/main/exercises/week-2/ex_2a_en.ipynb)
[Learning Challenge Exercise II-B](https://github.com/qiskit-community/IBMQuantumChallenge2020/blob/main/exercises/week-2/ex_2b_en.ipynb)| [Episode 3](https://youtu.be/kLizHnvTguE), [Episode 4](https://youtu.be/25PcR5Pn4hk) | Nov 16th 2020 | 72 | | Week 3 |[Final Challenge](https://github.com/qiskit-community/IBMQuantumChallenge2020/blob/main/exercises/week-3/final_en.ipynb) | [Episode 5](https://youtu.be/Bkk5-j6rpoM), [Episode 6](https://youtu.be/EC2Dc1QgLZY) | Nov 23rd 2020 | 73 |
74 | 75 | 76 | ## Final Exercise Submission Rules 77 | For valid submissions we ask that your solution adheres to the below rule.
78 | * Please implement the quantum circuit within **28 qubits**. 79 | * Use Grover's algorithm you learned in Week1 & 2 with **iteration = 1**. 80 | * The initial state for Grover's algorithm must be equal probability distributions. For example, if you want use only 3 computational bases for 2 qubits instead of 4 as the initial state. Then, the state will be sqrt(1/3)(|00⟩+|01⟩+|11⟩). 81 | * Please note that you can get the answer with the same endian as the one used in Week2 explanation. You should map the index of the problem into four classical registers c[0:4] in binary. c[0] is the highest bit and c[3] is the lowest bit. For example, when mapping 12, the furthest left bit of 1100 will be mapped to c[0]. 82 | * Make sure you **create an oracle** that **doesn't require knowledge of what the answers are**. (For example, you are not allowed to create an oracle by using a classical optimization solver to get your answers for it.)   83 | With the exception of the Unroller, which is required for decomposing your circuit to calculate quantum costs, you are not allowed to use any existing transpiler passes nor original transpilers for making simplifications in this competition. 84 | * Please **do not run jobs in succession** even if you are concerned that your job is not running properly. This can create a long queue and clog the backend. You can check whether your job is running properly at: https://quantum-computing.ibm.com/results   85 | * Your score for this exercise will be same as the cost of your QuantumCircuit. The lower the cost, the better. 86 | * Judges will check top 10 solutions manually to see if the solutions adhere to the rules. **Please note that your ranking is subject to change after the challenge period as a result of the judging process**.  87 | * Top 10 participants will be recognized and asked to submit a write up on how they solved the exercise. 88 | * **When mapping the board information into your quantum circuit, you must not change the board information from the original one. (i.e. Do not rearrange the asteroid positions, nor rotate, invert, swap rows and columns.)**  89 |
90 | 91 | 92 | 93 | 94 | -------------------------------- 95 | # IBM Quantum Challengeへようこそ! 96 | ## 当コンテストは2020年11月30日に終了しました。 97 | ## 順位表 98 | [順位表](./solutions/leaderboard.md): ファイナルチャレンジのトップ10のランキング表です。 99 | 100 | ## 最終問題の解法解説 101 | [最終問題解説](./solutions/week-3/ex_3_solution_ja.ipynb):ジャッジによる最終問題の解法例です。競技者の皆さんの独創的で素晴らしい解法↓↓↓もぜひチェックしてください。 102 | 103 | ## トップ10の解法解説 104 | [トップの解法解説](https://github.com/qiskit-community/IBMQuantumChallenge2020/tree/main/submissions): トップ10にランキングした皆さんが最終問題にどう挑んだのか。アプローチ、駆使したテクニックなどを公開しています。 105 | 106 | ## 重要:[最終問題の提出ルール](#final-exercise-submission-rules)
107 | 108 |
109 | 2020年も終わりに近づいてまいりましたが、量子コンピューティングの世界の新たな挑戦にご案内したいと思います。皆さんで一緒に量子の世界の新たなマイルストーンを達成しましょう! 110 | 111 | 2019年11月に初めて開催した[IBM Quantum Challenge](https://ibmquantum.angelhack.com/)では、量子情報の専門家から初心者の方まで多くの方にご参加いただきました。[IBM Qunatum Experience](https://quantum-computing.ibm.com/)誕生から4周年を祝して開催された2020年5月のIBM Quantum Challengeでは、45ヶ国から1745人の方が参加し、期間中に、18台のIBMの量子コンピューターシステムにおいて、1日に10億回の量子回路の計算が実行されました。 112 | 113 | 11月9日午前9時(日本時間)に開催される今回のChallengeは、3週間のChallengeです。ともに、量子コンピューターの知識・スキルを深め、Exercise問題に取り組んでまいりましょう。 114 | 115 | すべてのExercisesにおいて正解を提出できた方にDigital badgeをお送りします。 116 | 117 | 応募フォーム(Application Form)を完了し、Challenge事務局から確認メール(Confirmation Required)を受領し参加確認を行った方のみ、Challengeに参加可能です。 118 | 119 | 120 | ## プログラミング環境 121 | IBM Quantum ExperienceではPythonベースのオープンソースの量子開発フレームワークである**Qiskit**を利用します。 122 | 123 | 11月9日(月)のチャレンジ開始と同時に、参加者はIQXの専用サイトから、ホスティングされているJupyter Notebook内の問題を閲覧することが可能になります。参加者は自身のコンピュータにはQiskitをインストールすることなく、同ホスティング環境にてコードを記述、実行し、回答を提出することができます。 124 | 125 | 注)当ChallengeのIQX上の専用サイトは事前登録を済ませたのち、Challenge事務局からの確認メール(Confirmation Required)にて参加確認を行った方のみアクセス可能になります。予めご了承ください。 126 | 127 | 128 | ## 事前準備 129 | Challengeで出題されるExercise問題に取り組む際、すべてをIQX上で実行する前に、コードの作成や実行をローカルで試したい方もいらっしゃるでしょう。そういう場合のために、ご自身のパソコン環境にQiskitをインストールしておくことをお勧めします。Qiskitは量子コンピューターを使うためのPythonのオープンソース フレームワークです。パルスや回路、アルゴリズムといった様々なレイヤーで活用することができます。Qiskitの詳細は[Qiskit.org](https://qiskit.org)のページを参照して下さい。 130 | 131 | Qiskitは *pip* を用いてインストールできます。 132 | 133 | ``` 134 | $ pip install qiskit 135 | ``` 136 | インストールの詳細な手順については[Qiskitのインストール](https://qiskit.org/documentation/locale/ja/install.html)または[インストール動画](https://www.youtube.com/watch?v=M4EkW4VwhcI)を参照してください。 137 | 138 | ## チャレンジ内容 139 | 毎週以下の日付にそれぞれのチャレンジ内容を更新します。
140 | 141 | | ウィーク | チャレンジ | Dr.リョウコからのメッセージ |  更新日 | 142 | | --- | --- | --- | --- | 143 | | Week 0 |[初心者向け:量子計算の基礎](exercises/week-0/ex_0_ja.ipynb) | [Episode 1](https://youtu.be/eLw7fWb2xv4) | 公開済み | 144 | | Week 1 |[ラーニングチャレンジ演習 I-A](https://github.com/qiskit-community/IBMQuantumChallenge2020/blob/iqx/exercises/week-1/ex_1a_ja.ipynb)
[ラーニングチャレンジ演習 II-B](https://github.com/qiskit-community/IBMQuantumChallenge2020/blob/iqx/exercises/week-1/ex_1b_ja.ipynb)| [Episode 2](https://youtu.be/f8TEd_51rHI) | Nov 9th 2020 | 145 | | Week 2 |[ラーニングチャレンジ演習 II-A](https://github.com/qiskit-community/IBMQuantumChallenge2020/blob/main/exercises/week-2/ex_2a_ja.ipynb)
[ラーニングチャレンジ演習 II-B](https://github.com/qiskit-community/IBMQuantumChallenge2020/blob/main/exercises/week-2/ex_2b_ja.ipynb)| [Episode 3](https://youtu.be/kLizHnvTguE), [Episode 4](https://youtu.be/25PcR5Pn4hk) | Nov 16th 2020 | 146 | | Week 3 |[ファイナルチャレンジ(本戦)](https://github.com/qiskit-community/IBMQuantumChallenge2020/blob/main/exercises/week-3/final_ja.ipynb) | [Episode 5](https://youtu.be/Bkk5-j6rpoM), [Episode 6](https://youtu.be/EC2Dc1QgLZY) | Nov 23rd 2020 | 147 | 148 | 149 | -------------------------------- 150 | # ibm-quantum-challenge환영합니다! 151 | ## Thank you! We have completed this challenge on Nov 30th, 2020. 152 | ## 중요 : [최종 과제 제출 규칙](#final-exercise-submission-rules)
153 | 154 | 2020년 말이 다가오는 시점에 커뮤니티 여러분을 위해 양자 시스템의 한계를 뚫고 나아가 새로운 이정표를 달성할 수 있는 새롭고 흥미 진진한 챌린지를 준비했습니다. 155 | 156 | 2019년 11월에 처음으로 시작된 [IBM Quantum Challenge](https://ibmquantum.angelhack.com/)는 전 세계의 많은 개발자들과 입문자들을 양자컴퓨터로의 여정으로 인도했습니다. 그리고 2020년 5월, IBM Quantum Experience의 4주년을 기념하여 열린 [IBM Qunatum Experience](https://quantum-computing.ibm.com/)에서 총 45개국에서 온 1745명의 참가자들은 4개의 문제를 풀기 위해 IBM 클라우드를 통해 총 18개의 IBM Quantum systems을 사용하여, 하루 기준 10억 개의 양자 회로 연산 수행 기록을 달성했습니다. 157 | 158 | 돌아오는 11월 9일 오전 9시부터, 몇 가지의 잘 알려진 양자 알고리즘을 사용해 양자컴퓨팅과 Qiskit에 대한 지식과 기술을 높일 수 있는 과제가 준비되어 있는 3주간의 새로운 챌린지가 시작됩니다. 159 | 160 | 연습문제를 모두 성공적으로 완료한 참가자에게는 디지털 배지가 수여됩니다. 161 | 162 | 참가 신청 후 주최 측으로 부터 참가에 대한 공식 확인을 받아야 참가가 가능한 점에 유의하세요. 163 | 164 | 165 | ## 코딩 환경 166 | IBM Quantum Challenge는 IBM Quantum Experience (일명 IQX)에서 진행됩니다. IQX를 사용하는 경우 개인 컴퓨터에 라이브러리나 파일을 다운로드 하거나 설치할 필요 없이 IQX에 자체 포함 된 Jupyter 노트북 환경에서 양자 회로를 구성, 실행하고 도전 과제를 평가받을 수 있습니다. 167 | 168 | 2020 년 11 월 9 일 챌린지 사이트가 열리면 참가자는 코드를 직접 작성하고 실행하고 답변을 제출할 수있는이 독립형 Jupyter 노트북 환경에서 연습 문제를 풀고 제출하게 됩니다. 169 | 170 | 연습 문제에 도전할 수 있는 Jupyter notebook 작업 공간은 주최 측으로 부터 공식 참가 확인 이메일을 받고 참여가 확정된 참가자만이 접근 가능한 점에 꼭 유의하세요. 171 | 172 | 173 | ## 준비사항 174 | IBM Quantum Experience 환경에서 연습 문제의 정답을 제출하기 전에 개인 작업 환경(개인 노트북 및 컴퓨터의 로컬 환경)에서 미리 실습해 보고 싶을 수 있습니다. 이 경우 컴퓨터에 **Qiskit**을 설치해야합니다. Qiskit은 펄스, 회로 및 알고리즘 수준에서 양자 컴퓨터 작업을위한 Python 기반 오픈 소스 프레임 워크입니다. 자세한 내용은 [Qiskit.org](https://qiskit.org) 페이지를 참조하십시오. 175 | 176 | 177 | 178 | *pip*를 사용하여 Qiskit을 간단하게 설치할 수 있습니다. 179 | 180 | ``` 181 | $ pip install qiskit 182 | ``` 183 | 자세한 내용은 [Install Qiskit](https://qiskit.org/documentation/install.html)이나 [YouTube video](https://www.youtube.com/watch?v=M4EkW4VwhcI) 를 참고하세요. 184 | 185 | ## 도전 순서 186 | 도전 과제는 다음의 날짜에 공개됩니다.
187 | | Week | 도전 과제 | 료코 박사의 메시지 | Available on (KST) | 188 | | --- | --- | --- | --- | 189 | | Week 0 |[초보자 대상: 양자 컴퓨팅의 기초](exercises/week-0/ex_0_ko.ipynb) | [Episode 1](https://youtu.be/eLw7fWb2xv4) | 도전 가능 | 190 | | Week 1 |[도전 과제 I-A](exercises/week-1/ex_1a_ko.ipynb)
[도전 과제 I-B](exercises/week-1/ex_1b_ko.ipynb)| [Episode 2](https://youtu.be/f8TEd_51rHI) | 도전 가능 | 191 | | Week 2 |[도전 과제 II-A](exercises/week-2/ex_2a_ko.ipynb)
[도전 과제 II-B](exercises/week-2/ex_2b_ko.ipynb)| [Episode 3](https://youtu.be/kLizHnvTguE), [Episode 4](https://youtu.be/25PcR5Pn4hk) | 도전 가능 | 192 | | Week 3 |[최종 과제](exercises/week-3/final_ko.ipynb) | [Episode 5](https://youtu.be/Bkk5-j6rpoM), [Episode 6](https://youtu.be/EC2Dc1QgLZY) | 도전 가능 | 193 | -------------------------------------------------------------------------------- /exercises/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/exercises/.gitkeep -------------------------------------------------------------------------------- /exercises/week-0/composer01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/exercises/week-0/composer01.jpg -------------------------------------------------------------------------------- /exercises/week-0/composer02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/exercises/week-0/composer02.jpg -------------------------------------------------------------------------------- /exercises/week-0/composer03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/exercises/week-0/composer03.jpg -------------------------------------------------------------------------------- /exercises/week-0/composer04.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/exercises/week-0/composer04.jpg -------------------------------------------------------------------------------- /exercises/week-0/histogram01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/exercises/week-0/histogram01.jpg -------------------------------------------------------------------------------- /exercises/week-0/histogram02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/exercises/week-0/histogram02.jpg -------------------------------------------------------------------------------- /exercises/week-1/grover_algorithm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/exercises/week-1/grover_algorithm.png -------------------------------------------------------------------------------- /exercises/week-1/oracle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/exercises/week-1/oracle.png -------------------------------------------------------------------------------- /exercises/week-1/ryoko.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/exercises/week-1/ryoko.png -------------------------------------------------------------------------------- /exercises/week-1/step0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/exercises/week-1/step0.png -------------------------------------------------------------------------------- /exercises/week-1/step1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/exercises/week-1/step1.png -------------------------------------------------------------------------------- /exercises/week-1/step2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/exercises/week-1/step2.png -------------------------------------------------------------------------------- /exercises/week-1/unstructured_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/exercises/week-1/unstructured_search.png -------------------------------------------------------------------------------- /exercises/week-1/week-1/grover_algorithm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/exercises/week-1/week-1/grover_algorithm.png -------------------------------------------------------------------------------- /exercises/week-1/week-1/oracle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/exercises/week-1/week-1/oracle.png -------------------------------------------------------------------------------- /exercises/week-1/week-1/ryoko.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/exercises/week-1/week-1/ryoko.png -------------------------------------------------------------------------------- /exercises/week-1/week-1/step0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/exercises/week-1/week-1/step0.png -------------------------------------------------------------------------------- /exercises/week-1/week-1/step1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/exercises/week-1/week-1/step1.png -------------------------------------------------------------------------------- /exercises/week-1/week-1/step2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/exercises/week-1/week-1/step2.png -------------------------------------------------------------------------------- /exercises/week-1/week-1/unstructured_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/exercises/week-1/week-1/unstructured_search.png -------------------------------------------------------------------------------- /exercises/week-2/4lightsout_ex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/exercises/week-2/4lightsout_ex.png -------------------------------------------------------------------------------- /exercises/week-2/4lightsout_pr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/exercises/week-2/4lightsout_pr.png -------------------------------------------------------------------------------- /exercises/week-2/circuit_ex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/exercises/week-2/circuit_ex.png -------------------------------------------------------------------------------- /exercises/week-2/gatesynthesis_ex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/exercises/week-2/gatesynthesis_ex.png -------------------------------------------------------------------------------- /exercises/week-2/lights_out_prob.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/exercises/week-2/lights_out_prob.png -------------------------------------------------------------------------------- /exercises/week-2/lights_out_rule.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/exercises/week-2/lights_out_rule.png -------------------------------------------------------------------------------- /exercises/week-3/asteroids_beam_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/exercises/week-3/asteroids_beam_example.png -------------------------------------------------------------------------------- /exercises/week-3/asteroids_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/exercises/week-3/asteroids_example.png -------------------------------------------------------------------------------- /exercises/week-3/false_asteroids_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/exercises/week-3/false_asteroids_example.png -------------------------------------------------------------------------------- /exercises/week-3/ryoko.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/exercises/week-3/ryoko.png -------------------------------------------------------------------------------- /fig/ep1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/fig/ep1.png -------------------------------------------------------------------------------- /fig/ep2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/fig/ep2.png -------------------------------------------------------------------------------- /fig/ep3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/fig/ep3.png -------------------------------------------------------------------------------- /fig/ep4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/fig/ep4.png -------------------------------------------------------------------------------- /fig/ep5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/fig/ep5.png -------------------------------------------------------------------------------- /fig/ep6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/fig/ep6.png -------------------------------------------------------------------------------- /hints/hint_1a.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/hints/hint_1a.pdf -------------------------------------------------------------------------------- /hints/hint_1b.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/hints/hint_1b.pdf -------------------------------------------------------------------------------- /hints/hint_2a.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/hints/hint_2a.pdf -------------------------------------------------------------------------------- /hints/hint_2a_nb/hint_2a_board.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/hints/hint_2a_nb/hint_2a_board.png -------------------------------------------------------------------------------- /hints/hint_2a_nb/hint_2a_circuit.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/hints/hint_2a_nb/hint_2a_circuit.jpg -------------------------------------------------------------------------------- /hints/hint_2a_nb/hint_2a_flip_tile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/hints/hint_2a_nb/hint_2a_flip_tile.png -------------------------------------------------------------------------------- /hints/hint_2a_nb/hint_2a_flip_tile_circuit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/hints/hint_2a_nb/hint_2a_flip_tile_circuit.png -------------------------------------------------------------------------------- /hints/hint_2b.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/hints/hint_2b.pdf -------------------------------------------------------------------------------- /hints/hint_3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/hints/hint_3.pdf -------------------------------------------------------------------------------- /quizzes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/quizzes/.gitkeep -------------------------------------------------------------------------------- /quizzes/quiz_1/quantum_challenge_quiz_1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/quizzes/quiz_1/quantum_challenge_quiz_1.pdf -------------------------------------------------------------------------------- /quizzes/quiz_1/quantum_challenge_quiz_1.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/quizzes/quiz_1/quantum_challenge_quiz_1.pptx -------------------------------------------------------------------------------- /quizzes/quiz_2/quantum_challenge_quiz_2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/quizzes/quiz_2/quantum_challenge_quiz_2.pdf -------------------------------------------------------------------------------- /quizzes/quiz_2/quantum_challenge_quiz_2.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/quizzes/quiz_2/quantum_challenge_quiz_2.pptx -------------------------------------------------------------------------------- /quizzes/quiz_3/quantum_challenge_quiz_3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/quizzes/quiz_3/quantum_challenge_quiz_3.pdf -------------------------------------------------------------------------------- /quizzes/quiz_3/quantum_challenge_quiz_3.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/quizzes/quiz_3/quantum_challenge_quiz_3.pptx -------------------------------------------------------------------------------- /solutions/amatsuo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/solutions/amatsuo.png -------------------------------------------------------------------------------- /solutions/drteaching.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/solutions/drteaching.jpg -------------------------------------------------------------------------------- /solutions/leaderboard.md: -------------------------------------------------------------------------------- 1 | # Final Exercise Leaderboard 2 | 3 | ## Congratulations to the winners and top scorers! 4 | 5 | Thank you to everyone who submitted their code to the final challenge!
6 | The following shows the top ten scorers who submitted their code to the final challenge (Nov 30, 2020 13:00 JST)
7 | 8 | 9 | ### Top Ten Scorers 10 | *(Note: All top scorers submissions have been verified by judges and scores are finalized. Their decision will be final and no further discussions will be held.)* 11 | 12 | | Ranking | Name | Score | 13 | | --- | --- | --- | 14 | | 1 | Hironari Nagayoshi | 4004 | 15 | | 2 | Adam Szady | 4819 | 16 | | 3 | Pulkit Sinha | 5124 | --- | 17 | | 4 | Witold Jarnicki | 6065 | --- | 18 | | 5 | Lukas Burgholzer | 6552 | --- | 19 | | 6 | Jan Tulowiecki | 6574 | --- | 20 | | 7 | Guillermo Alonso | 7799 | --- | 21 | | 8 | Stefan Hillmich | 8188 | --- | 22 | | 9 | Joel Sunil  | 8864 | --- | 23 | | 10 | Chris Chen | 9127 | --- | 24 | 25 | ## Judges 26 | The following members served as judges for the challenge. They were the core members who created the exercises for our IBM Quantum Challenge Fall 2020.
27 | 28 | ![image of dr. satoh](tsatoh.png)
29 | **Dr. Takahiko Satoh**
30 | **Project Assistant Professor, Keio Quantum Computing Center**
31 | 32 | ![image of shin nishio](snishio.png)
33 | **Shin Nishio**
34 | **Research Assistant, National Institute of Informatics/SOKENDAI**
35 | 36 | ![image of atsushi matsuo](amatsuo.png)
37 | **Atsushi Matsuo**
38 | **Researcher, IBM Quantum**
39 | 40 | 41 | ## How we determined the score 42 | Scores were determined by measuring the circuit implementation cost to solve the final exercise.
43 | Cost is defined as: Cost = *S* + 10*C*  where *S* is the number of single-qubit gates and *C* is the number of CNOT (CX) gates. 
Any given quantum circuit can be decomposed into single-qubit gates and two-qubit gates.
With the current Noisy Intermediate-Scale Quantum (NISQ) devices, CNOT error rates are generally ten times higher than a single qubit gate.Therefore, we weigh CNOT gates ten times more than a single-qubit gate for evaluating the circuit implementation cost.
44 | The lower the cost, the better. 45 | 46 | 47 | -------------------------------- 48 | # Participants who completed the final exercise 49 | 50 | ## Congratulations to all who completed the final exercise! 51 | 52 | *(Listed in alphabetical order)*
53 | Kusal Mahendra Abeywickrama, 54 | Mitesh Adake, 55 | Chulwoo Ahn, 56 | Riccardo Aiudi, 57 | Ibrahim Almosallam, 58 | Guillermo Alonso, 59 | Md Sajid Anis, 60 | Riya Arora, 61 | Kaito Asai, 62 | Hiroki Asakawa, 63 | Mostafa Atallah, 64 | Diego Athayde Monteiro, 65 | Bao Bach, 66 | Vishal Bajpe, 67 | Armando Bellante, 68 | Juan Bernardo Benavides Rubio, 69 | Naphan Benchasattabuse, 70 | Amandeep Bhatia, 71 | Gary Bilkus, 72 | Subhadeep Biswas, 73 | Sorin Bolos, 74 | Luigi Bonati, 75 | Aditya Bothra, 76 | Sebastian Brandhofer, 77 | Lukas Burgholzer, 78 | Fabiola Cañete Leyva, 79 | Ivan Carvalho, 80 | Carlo Cascio, 81 | Mantas Cepulkovskis, 82 | Sanivarapu Sarath Chandra Reddy, 83 | Adarsh Chandrashekar, 84 | Chris (Jielun) Chen, 85 | Man Hin Cheng, 86 | Manav Chhibber, 87 | Wei-Chen Chien, 88 | Yujin Cho, 89 | Peter Cogill, 90 | Adrian Copetudo Espinosa, 91 | Franklin de Lima Marquezino, 92 | Pascal Debus, 93 | Indranil Dey, 94 | Sagar Dollin, 95 | Patrick Downing, 96 | Nico Einsidler, 97 | Paul Faehrmann, 98 | Fabrizio Finozzi, 99 | Khurshed Fitter, 100 | Aboulkhair Foda, 101 | Guillermo Andrés Fonseca Kuvacic, 102 | Pablo Formoso Estrada, 103 | Shion Fukuzawa, 104 | Sri Ram Kailash G, 105 | Subrahmanyam Gantasala, 106 | Tanya Garg, 107 | Bahman Ghandchi, 108 | Elies Gil-Fuster, 109 | Bhaavan Goel, 110 | Wittmann Goh, 111 | Dhruv Gopalakrishnan, 112 | Nancy Goyal, 113 | Saumya Goyal, 114 | Anne-Lise Guilmin, 115 | Manvi Gusain, 116 | Moritz Gutt, 117 | Ramy Harib, 118 | Ruofan He, 119 | Stefan Hillmich, 120 | Marcel Hinsche, 121 | Tom Holden-Dye, 122 | Calum Holker, 123 | Meng Hua, 124 | Shadab Hussain, 125 | Yuki Ito, 126 | Dustin Jacqmin, 127 | Ammar Jahin, 128 | Vipul Jain, 129 | Vaibhav Jain, 130 | Babita Jajodia, 131 | Witold Jarnicki, 132 | Praveen Jayakumar, 133 | Siyu Jian, 134 | Kiran Johns, 135 | Saasha Joshi, 136 | Akshay Kale, 137 | Sumit Suresh Kale, 138 | Sampreet Kalita, 139 | Shruti Kalkar, 140 | Eyal Kalman, 141 | Yusuke Kanamori, 142 | Marius Kavaliauskas, 143 | Akito Kawasaki, 144 | Josh Kelso, 145 | Nikhil Keshav, 146 | Ufuk Keskin, 147 | Dongsin Kim, 148 | Gyeonghun Kim, 149 | Hoyoung Kim, 150 | Saesun Kim, 151 | Hiraku Koduma, 152 | Yuki Koizumi, 153 | Eileen Kuehn, 154 | Hideto Kumakura, 155 | Jitesh Lalwani, 156 | Denisa Lampášová, 157 | Samantha Lang, 158 | Elbert Timothy Lasiman, 159 | I-KWAN Lee, 160 | Xinwei Lee, 161 | Polina Levyant, 162 | Tai Yue Li, 163 | Zhengze Li, 164 | Billy Lim Jun Ming, 165 | Deep Lokhande, 166 | Shufan Lu, 167 | Taoyuze Lv, 168 | Chien-Kai Ma, 169 | Onkar Madli, 170 | Danyal Maheshwari, 171 | Ritajit Majumdar, 172 | Jyot Makadiya, 173 | Alberto Maldonado Romo, 174 | Andres Camilo Marulanda Bran, 175 | Sergi Masot Llima, 176 | Alena Mastiukova, 177 | Anuj Mehrotra, 178 | Kou Misaki, 179 | Abhigyan Mishra, 180 | Abhijit Mitra, 181 | Naoki Mitsui, 182 | Shah Mohtashim, 183 | Sukrut Mondkar, 184 | Masato Mouri, 185 | Tristan Müller, 186 | Eraraya Ricardo Muten, 187 | Keerthiraj Nagaraj, 188 | Hironari Nagayoshi, 189 | Soshun Naito, 190 | Yuya Nakagawa, 191 | Yudai Nakakubo, 192 | Shota Nakasuji, 193 | Rafael Nepomechie, 194 | Ana Nikolic, 195 | Keith O'Donnell, 196 | Ryunosuke Okubo, 197 | Kosuke Onishi, 198 | Tamiya Onodera, 199 | Renganathan Palanisamy, 200 | Joachim Paret, 201 | Eunju Park, 202 | Carlos Pegueros, 203 | Huba Péter, 204 | Dario Petrillo, 205 | Kamen Petroff, 206 | Jakub Pilch, 207 | Krishanu Podder, 208 | Rohit Prasad, 209 | Florian Preis, 210 | Ziwei Qiu, 211 | Mohammed Aamir Qudsi, 212 | Khushwanth Kumar Ragam, 213 | Suryaprasath Ramalingam, 214 | Ricardo Ramirez, 215 | Kenyi Josué Ramírez Palacios, 216 | Chang Ran-Yu, 217 | Michael Rollin, 218 | Gonzalo Rubio Martínez, 219 | Lewis Ruks, 220 | Hyunwoo Ryu, 221 | Nahum Sá, 222 | Saptarshi Sahoo, 223 | Najla Said, 224 | Freddie Samy, 225 | Hirmay Sandesara, 226 | Radha Pyari Sandhir, 227 | Andy Saporito, 228 | Hayk Sargsyan, 229 | Md. Sakibul Islam Sazzad, 230 | John Schneider, 231 | Pinaki Sen, 232 | Jayath Seneviratne, 233 | Diego Emilio Serrano, 234 | Vadim Shabashov, 235 | Farida Shagieva, 236 | Soyoung Shin, 237 | Shashwat Shukla, 238 | Daniel Sierra-Sosa, 239 | Divyanshu Singh, 240 | Prakhar Singh, 241 | Rishabh Singhal, 242 | Pulkit Sinha, 243 | Satzhan Sitmukhambetov, 244 | Kouhei Souji, 245 | Adrien Suau, 246 | Gary Sung, 247 | Jirayu Supasil, 248 | Adam Szady, 249 | Muhammed Jabir T, 250 | Shokichi Takakura, 251 | Nobuhiko Tamura, 252 | Ritu Thombre, 253 | Miroslav Tomasik, 254 | Andrei Voicu Tomut, 255 | Tony Tong, 256 | Duc Tran, 257 | Georgios Tsilimigkounakis, 258 | Satoyuki Tsukano, 259 | Jan Tułowiecki, 260 | Hironori Uchikawa, 261 | Arthi Udayakumar, 262 | Abhirami V S, 263 | Natan Vander Meeren, 264 | Chetan Vardhan, 265 | Sanjay Vishwakarma, 266 | Alexander Vlasov, 267 | Ryo Wakizaka, 268 | Joshua Wang, 269 | Anosh Wasker, 270 | Ming-Tso Wei, 271 | Christof Wendenius, 272 | Weichen Xie, 273 | Hiroyuki Yamada, 274 | Yuya Yoshimura, 275 | Zhenhua Zhang, 276 | Zhiyong Zhang
277 |
278 | ![image of dr. ryoko teaching students](drteaching.jpg) -------------------------------------------------------------------------------- /solutions/snishio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/solutions/snishio.png -------------------------------------------------------------------------------- /solutions/tsatoh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/solutions/tsatoh.png -------------------------------------------------------------------------------- /solutions/week-1/ex_1b_solutions_en.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Learning Exercise I-B\n", 8 | "Find the number of iterations with the largest amplitude when you run the Grover's algorithm with one solution in a database with $N = 2 ^ 7$. As shown above, change the number of iterations and check the amplification. The answer must be an integer.\n", 9 | "\n", 10 | "Hint: Fewer than 15 times. " 11 | ] 12 | }, 13 | { 14 | "cell_type": "markdown", 15 | "metadata": {}, 16 | "source": [ 17 | "## Answer \n", 18 | "As explained in hint by Ryoko, the optimal number of times can be calculated using the following formula.\n", 19 | "$$t = \\frac{\\pi}{4}\\sqrt{N}-\\frac{1}{2}$$\n", 20 | "\n", 21 | "Let's find the optimum number of iterations (approximate) when N is up to $2^{16}$." 22 | ] 23 | }, 24 | { 25 | "cell_type": "code", 26 | "execution_count": 1, 27 | "metadata": {}, 28 | "outputs": [ 29 | { 30 | "name": "stdout", 31 | "output_type": "stream", 32 | "text": [ 33 | "['N:1', 'Number of iteration:0.2853981633974483']\n", 34 | "['N:2', 'Number of iteration:0.6107207345395915']\n", 35 | "['N:4', 'Number of iteration:1.0707963267948966']\n", 36 | "['N:8', 'Number of iteration:1.721441469079183']\n", 37 | "['N:16', 'Number of iteration:2.641592653589793']\n", 38 | "['N:32', 'Number of iteration:3.942882938158366']\n", 39 | "['N:64', 'Number of iteration:5.783185307179586']\n", 40 | "['N:128', 'Number of iteration:8.385765876316732']\n", 41 | "['N:256', 'Number of iteration:12.066370614359172']\n", 42 | "['N:512', 'Number of iteration:17.271531752633464']\n", 43 | "['N:1024', 'Number of iteration:24.632741228718345']\n", 44 | "['N:2048', 'Number of iteration:35.04306350526693']\n", 45 | "['N:4096', 'Number of iteration:49.76548245743669']\n", 46 | "['N:8192', 'Number of iteration:70.58612701053386']\n", 47 | "['N:16384', 'Number of iteration:100.03096491487338']\n", 48 | "['N:32768', 'Number of iteration:141.67225402106772']\n" 49 | ] 50 | } 51 | ], 52 | "source": [ 53 | "# Number of iteration \n", 54 | "import math\n", 55 | "import numpy as np\n", 56 | "def num_iter(n):\n", 57 | " res = ((np.pi/4) * (math.sqrt(n))) - (1/2)\n", 58 | " iter_list = ['N:'+str(n), 'Number of iteration:'+ str(res)]\n", 59 | " return iter_list\n", 60 | "\n", 61 | "for i in range(16):\n", 62 | " n = 2**i\n", 63 | " print(num_iter(n))" 64 | ] 65 | }, 66 | { 67 | "cell_type": "markdown", 68 | "metadata": {}, 69 | "source": [ 70 | "We got 8.39. It's about 8.\n", 71 | "\n", 72 | "Let's generate a quantum circuit and check the actual amplification. Generate a circuit to search for 47 (use any number up to $2^7$-1) from $2^7$." 73 | ] 74 | }, 75 | { 76 | "cell_type": "code", 77 | "execution_count": 2, 78 | "metadata": {}, 79 | "outputs": [], 80 | "source": [ 81 | "# importing Qiskit\n", 82 | "from qiskit import Aer\n", 83 | "from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, execute\n", 84 | "from qiskit.providers.aer import QasmSimulator\n", 85 | "\n", 86 | "backend = Aer.get_backend('qasm_simulator')\n", 87 | "prob_of_ans = []\n", 88 | "\n", 89 | "for x in range(15):\n", 90 | " database = QuantumRegister(7)\n", 91 | " oracle = QuantumRegister(1)\n", 92 | " ancilla = QuantumRegister(5) \n", 93 | " cr = ClassicalRegister(7)\n", 94 | " qc = QuantumCircuit(database, oracle, ancilla, cr)\n", 95 | " qc.h(database[:])\n", 96 | " qc.x(oracle[0])\n", 97 | " qc.h(oracle[0])\n", 98 | "\n", 99 | "\n", 100 | " for j in range(x):\n", 101 | " # oracle_7q\n", 102 | " # search 47: 0101111\n", 103 | " qc.x(database[0])\n", 104 | " qc.x(database[2])\n", 105 | " qc.mct(database[:], oracle[0], ancilla[:], mode='basic') \n", 106 | " qc.x(database[0])\n", 107 | " qc.x(database[2])\n", 108 | "\n", 109 | " # diffusion_7q\n", 110 | " qc.h(database[:])\n", 111 | " qc.x(database[:])\n", 112 | " qc.h(database[6])\n", 113 | " qc.mct(database[0:6], database[6], ancilla[:], mode='basic')\n", 114 | " qc.h(database[6])\n", 115 | " qc.x(database[:])\n", 116 | " qc.h(database[:])\n", 117 | "\n", 118 | "\n", 119 | " qc.h(oracle[0])\n", 120 | " qc.x(oracle[0])\n", 121 | " qc.measure(database,cr)\n", 122 | " # Change the endian \n", 123 | " qc = qc.reverse_bits() \n", 124 | "\n", 125 | " job = execute(qc, backend=backend, shots=1000, backend_options={\"fusion_enable\":True})\n", 126 | " result = job.result()\n", 127 | " count = result.get_counts()\n", 128 | " answer = count['0101111']\n", 129 | " prob_of_ans.append(answer)" 130 | ] 131 | }, 132 | { 133 | "cell_type": "code", 134 | "execution_count": 3, 135 | "metadata": {}, 136 | "outputs": [ 137 | { 138 | "data": { 139 | "text/plain": [ 140 | "Text(0, 0.5, '# of times the solution was obtained')" 141 | ] 142 | }, 143 | "execution_count": 3, 144 | "metadata": {}, 145 | "output_type": "execute_result" 146 | }, 147 | { 148 | "data": { 149 | "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEGCAYAAACUzrmNAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAcBUlEQVR4nO3deZxcZZ3v8c+XBEGUGCCBgSx2ohkQGTabHRkkzgxLJNEJDAxLBOZmZi4DwVEgLK/B63U0LlcEVJzIFiDCOCwXFAQxgMgWSCALELxkICQtkYQ9iEsCv/vHecoUne6u0119qk6nvu/Xq151znNO1fMjofPr5zybIgIzM7OebNLsAMzMrPycLMzMrCYnCzMzq8nJwszManKyMDOzmgY3O4AiDBs2LNra2podhpnZgDJ//vyXImJ4V9c2ymTR1tbGvHnzmh2GmdmAIun57q75MZSZmdXkZGFmZjU5WZiZWU1O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z3ytKp43Jf27pIWSHpa0XRF/rtYCIsIvv1rqRbbc/CXApsADPdz3Y2BKOj4Z+L/p+LPAd7r5zL1k+0sAvFlV/pH0fZum8+8BJ6bjAI6uunfrquNrgE91/u7qc7JFBJcDw8kWQLwbmFT13ZXPfx04v9l//n4NzJdbFtaK9gAWADvR83pP+wE/TMfXAAfWUed44GPAo5IWpPOx6drbZIs/Vnwi9YksBg4BPlrju/cC7o1sQcHKaqkHpWt/BCq7Ec4H2ur4b7AWNrjZAZg1SnqEdBXZap0vkW0WpPSP934R8bsaX1FPB5+AWRHR1e5rv4/UT6FsW9TvkbUgVkj6IlBrq9Suls+vWBsRlbjfxj/z1kduWVjLiIgFEbE72ZaZO5M9rvmbiNi9m0TxIOu3KT0OuL+XVa5NS8ZDtpXoZEnbwp/2pP5gF5+pJIaX0r4kk6uurSFb6K6zucBfShqW+kGOBX7Ry1jNeuTfMqylSBoOvBoR70jaKSJ6egx1OnCFpDPJds07qZfVzQQWSXosIo6TdD7wM0mbAGuBU4Hnqz8QEa9J+gHZKrLLyJbGr7gK+L6k35E9Iqt8ZqWkc4B7yFoZt0dE6ZYAt4HNQ2fNzKwmP4YyM7OanCzMzKwmJwszM6vJycLMzGpysjAzs5qcLMzMrCYnCzMzq+n/A09hVTb2oATNAAAAAElFTkSuQmCC\n", 150 | "text/plain": [ 151 | "
" 152 | ] 153 | }, 154 | "metadata": { 155 | "needs_background": "light" 156 | }, 157 | "output_type": "display_data" 158 | } 159 | ], 160 | "source": [ 161 | "import matplotlib.pyplot as plt\n", 162 | "iteration = [i for i in range(15)]\n", 163 | "plt.bar(iteration, prob_of_ans)\n", 164 | "plt.xlabel('# of iteration')\n", 165 | "plt.ylabel('# of times the solution was obtained')" 166 | ] 167 | }, 168 | { 169 | "cell_type": "markdown", 170 | "metadata": {}, 171 | "source": [ 172 | "The answer is 8. " 173 | ] 174 | } 175 | ], 176 | "metadata": { 177 | "kernelspec": { 178 | "display_name": "Python 3", 179 | "language": "python", 180 | "name": "python3" 181 | }, 182 | "language_info": { 183 | "codemirror_mode": { 184 | "name": "ipython", 185 | "version": 3 186 | }, 187 | "file_extension": ".py", 188 | "mimetype": "text/x-python", 189 | "name": "python", 190 | "nbconvert_exporter": "python", 191 | "pygments_lexer": "ipython3", 192 | "version": "3.7.4" 193 | } 194 | }, 195 | "nbformat": 4, 196 | "nbformat_minor": 4 197 | } 198 | -------------------------------------------------------------------------------- /solutions/week-1/ex_1b_solutions_ja.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# ラーニング演習 I-B\n", 8 | "\n", 9 | "$N = 2 ^ 7$のデータベースにおいてグローバーのアルゴリズムを実行するときに最大振幅を得る繰り返しの回数を答えよ。上の例で示したように、繰り返し回数を変えて、振幅を調べよ。解答は整数である必要があります。\n", 10 | "\n", 11 | "ヒント:答えは、15回以下です。" 12 | ] 13 | }, 14 | { 15 | "cell_type": "markdown", 16 | "metadata": {}, 17 | "source": [ 18 | "## 解答\n", 19 | "\n", 20 | "Ryokoちゃんからのヒントで解説があったように、最適な回数は以下の式で計算できます。\n", 21 | "\n", 22 | "$$t = \\frac{\\pi}{4}\\sqrt{N}-\\frac{1}{2}$$\n", 23 | "\n", 24 | "Nが$2^{16}$までの場合の最適な反復回数(の概算値)を計算してみます。" 25 | ] 26 | }, 27 | { 28 | "cell_type": "code", 29 | "execution_count": 1, 30 | "metadata": {}, 31 | "outputs": [ 32 | { 33 | "name": "stdout", 34 | "output_type": "stream", 35 | "text": [ 36 | "['N:1', 'Number of iteration:0.2853981633974483']\n", 37 | "['N:2', 'Number of iteration:0.6107207345395915']\n", 38 | "['N:4', 'Number of iteration:1.0707963267948966']\n", 39 | "['N:8', 'Number of iteration:1.721441469079183']\n", 40 | "['N:16', 'Number of iteration:2.641592653589793']\n", 41 | "['N:32', 'Number of iteration:3.942882938158366']\n", 42 | "['N:64', 'Number of iteration:5.783185307179586']\n", 43 | "['N:128', 'Number of iteration:8.385765876316732']\n", 44 | "['N:256', 'Number of iteration:12.066370614359172']\n", 45 | "['N:512', 'Number of iteration:17.271531752633464']\n", 46 | "['N:1024', 'Number of iteration:24.632741228718345']\n", 47 | "['N:2048', 'Number of iteration:35.04306350526693']\n", 48 | "['N:4096', 'Number of iteration:49.76548245743669']\n", 49 | "['N:8192', 'Number of iteration:70.58612701053386']\n", 50 | "['N:16384', 'Number of iteration:100.03096491487338']\n", 51 | "['N:32768', 'Number of iteration:141.67225402106772']\n" 52 | ] 53 | } 54 | ], 55 | "source": [ 56 | "# 反復回数\n", 57 | "import math\n", 58 | "import numpy as np\n", 59 | "def num_iter(n):\n", 60 | " res = ((np.pi/4) * (math.sqrt(n))) - (1/2)\n", 61 | " iter_list = ['N:'+str(n), 'Number of iteration:'+ str(res)]\n", 62 | " return iter_list\n", 63 | "\n", 64 | "for i in range(16):\n", 65 | " n = 2**i\n", 66 | " print(num_iter(n))" 67 | ] 68 | }, 69 | { 70 | "cell_type": "markdown", 71 | "metadata": {}, 72 | "source": [ 73 | "$N = 2 ^ 7= 128$の場合は、8.39、つまり約8です。\n", 74 | "\n", 75 | "量子回路を作って、実際の振幅をチェックしてみましょう。 $2^7$から47を探索する回路を作ります。($2^7$-1までの数字ならどの数字を探索しても良いです。)" 76 | ] 77 | }, 78 | { 79 | "cell_type": "code", 80 | "execution_count": 2, 81 | "metadata": {}, 82 | "outputs": [ 83 | { 84 | "name": "stderr", 85 | "output_type": "stream", 86 | "text": [ 87 | "//anaconda3/envs/qiskit023/lib/python3.7/site-packages/ipykernel_launcher.py:45: DeprecationWarning: Using `backend_options` kwarg has been deprecated as of qiskit-aer 0.7.0 and will be removed no earlier than 3 months from that release date. Runtime backend options should now be added directly using kwargs for each option.\n" 88 | ] 89 | } 90 | ], 91 | "source": [ 92 | "# Qiskitをインポートします\n", 93 | "from qiskit import Aer\n", 94 | "from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, execute\n", 95 | "from qiskit.providers.aer import QasmSimulator\n", 96 | "\n", 97 | "backend = Aer.get_backend('qasm_simulator')\n", 98 | "prob_of_ans = []\n", 99 | "\n", 100 | "for x in range(15):\n", 101 | " database = QuantumRegister(7)\n", 102 | " oracle = QuantumRegister(1)\n", 103 | " ancilla = QuantumRegister(5) \n", 104 | " cr = ClassicalRegister(7)\n", 105 | " qc = QuantumCircuit(database, oracle, ancilla, cr)\n", 106 | " qc.h(database[:])\n", 107 | " qc.x(oracle[0])\n", 108 | " qc.h(oracle[0])\n", 109 | "\n", 110 | "\n", 111 | " for j in range(x):\n", 112 | " # 7qubitのオラクル\n", 113 | " # 47を探索します: 0101111\n", 114 | " qc.x(database[0])\n", 115 | " qc.x(database[2])\n", 116 | " qc.mct(database[:], oracle[0], ancilla[:], mode='basic') \n", 117 | " qc.x(database[0])\n", 118 | " qc.x(database[2])\n", 119 | "\n", 120 | " # 7qubitのDiffusion回路\n", 121 | " qc.h(database[:])\n", 122 | " qc.x(database[:])\n", 123 | " qc.h(database[6])\n", 124 | " qc.mct(database[0:6], database[6], ancilla[:], mode='basic')\n", 125 | " qc.h(database[6])\n", 126 | " qc.x(database[:])\n", 127 | " qc.h(database[:])\n", 128 | "\n", 129 | "\n", 130 | " qc.h(oracle[0])\n", 131 | " qc.x(oracle[0])\n", 132 | " qc.measure(database,cr)\n", 133 | " # エンディアンの変更 \n", 134 | " qc = qc.reverse_bits() \n", 135 | "\n", 136 | " job = execute(qc, backend=backend, shots=1000, backend_options={\"fusion_enable\":True})\n", 137 | " result = job.result()\n", 138 | " count = result.get_counts()\n", 139 | " answer = count['0101111']\n", 140 | " prob_of_ans.append(answer)" 141 | ] 142 | }, 143 | { 144 | "cell_type": "code", 145 | "execution_count": 3, 146 | "metadata": {}, 147 | "outputs": [ 148 | { 149 | "data": { 150 | "text/plain": [ 151 | "Text(0, 0.5, '# of times the solution was obtained')" 152 | ] 153 | }, 154 | "execution_count": 3, 155 | "metadata": {}, 156 | "output_type": "execute_result" 157 | }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X04qIiLZJzSIiIrpKsoiIiK6SLCIioqski4iI6CrJIiIiukqyiIEk6VOS3iBpP0krNWGcpBmSri7TgLx22LmThyZvlPThSY75XZJeMtKzIpqWV2djIEm6lGoyw08CZ9n+8Urc+3bgjbbf0+W6X9l+4UrGtbrtZ0Y5dznwj7YXrcx3RkyG1CxioJQ1C24Ctqca8PQe4CRJz5lvR9JsSZeW9Q0ukbSppG2BfwX2LQO3nj/snsslzZV0HNVssDdIOqOcO0TSNaXs/5Rp75H0K0n/JulGYCdJ/yTp2rJGxQJV9gfmUg0SvEHS84eeVb7jIEk3l3s+3RHPryT9i6QbJf1UUtsn8Iu2sp0t20BtVIniRGAN4MdjXPdtYF7Zfzfw/8r+u4AvjnLP5VTrSwD8qqP8L8v3rVGOvwS8s+wbOLDj2g069k8H3jL8uzuPqSYRvA+YQTUB4qXAfh3fPXT/vwIf7feff7apuaVmEYNoO+BGYEvGnktpJ+AbZf90YJcJPHM34FXAtZJuKMeblXPPUE3+OOQNpU/kZmBX4OVdvnt74HJXEwoOzZb6unLu98DQaoSLgdkT+G+IATat3wFE9EppQjqVarbOh6kWC1L5x3sn279p8vHAQtsjdab/1qWfQtWyqF+iqkHcL+njwESWSn3K9lDH5DPkZz7GKTWLGBi2b7C9LdWSmVtRNde82fa2oySKq3h2mdKDgR+t5COfKlPGQ7WU6P6SXgx/XJP6z0e4ZygxPFzWJdm/49wTVBPdDXcN8FeSppd+kIOAH65krBFjym8ZMVAkzQAesf0HSVvaHmva8aOoVsr7ANWqeYet5OMWADdJus72wZI+Cnxf0mrAU8CRwL2dN9h+VNJXgFuoVpS7tuP0qcCXJf2Gqols6J7lkuYDl1HVYC6w3bopwGNqy6uzERHRVZqhIiKiqySLiIjoKskiIiK6SrKIiIiukiwiIqKrJIuIiOgqySIiIrr6T9R3V9GWhLw/AAAAAElFTkSuQmCC\n", 161 | "text/plain": [ 162 | "
" 163 | ] 164 | }, 165 | "metadata": { 166 | "needs_background": "light" 167 | }, 168 | "output_type": "display_data" 169 | } 170 | ], 171 | "source": [ 172 | "import matplotlib.pyplot as plt\n", 173 | "iteration = [i for i in range(15)]\n", 174 | "plt.bar(iteration, prob_of_ans)\n", 175 | "plt.xlabel('# of iteration')\n", 176 | "plt.ylabel('# of times the solution was obtained')" 177 | ] 178 | }, 179 | { 180 | "cell_type": "markdown", 181 | "metadata": {}, 182 | "source": [ 183 | "答えは8です。" 184 | ] 185 | } 186 | ], 187 | "metadata": { 188 | "kernelspec": { 189 | "display_name": "Python 3", 190 | "language": "python", 191 | "name": "python3" 192 | }, 193 | "language_info": { 194 | "codemirror_mode": { 195 | "name": "ipython", 196 | "version": 3 197 | }, 198 | "file_extension": ".py", 199 | "mimetype": "text/x-python", 200 | "name": "python", 201 | "nbconvert_exporter": "python", 202 | "pygments_lexer": "ipython3", 203 | "version": "3.7.4" 204 | } 205 | }, 206 | "nbformat": 4, 207 | "nbformat_minor": 4 208 | } 209 | -------------------------------------------------------------------------------- /solutions/week-1/participant solutions/readme.txt: -------------------------------------------------------------------------------- 1 | folder for participants to share their solutions -------------------------------------------------------------------------------- /solutions/week-2/participant solutions/readme.txt: -------------------------------------------------------------------------------- 1 | folder for participants to share their solutions -------------------------------------------------------------------------------- /solutions/week-3/Hint_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/solutions/week-3/Hint_3.png -------------------------------------------------------------------------------- /solutions/week-3/OR_cover_edge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/solutions/week-3/OR_cover_edge.png -------------------------------------------------------------------------------- /solutions/week-3/ex_3_overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/solutions/week-3/ex_3_overview.png -------------------------------------------------------------------------------- /solutions/week-3/final_circuit_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/solutions/week-3/final_circuit_1.png -------------------------------------------------------------------------------- /solutions/week-3/final_circuit_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/solutions/week-3/final_circuit_2.png -------------------------------------------------------------------------------- /solutions/week-3/sample_problem_set.json: -------------------------------------------------------------------------------- 1 | {"0": [[["0", "0"], ["0", "1"], ["2", "2"], ["2", "3"], ["3", "1"], ["3", "2"]], [["0", "1"], ["1", "1"], ["1", "2"], ["2", "0"], ["3", "0"], ["3", "2"]], [["0", "1"], ["1", "0"], ["1", "2"], ["2", "1"], ["2", "3"], ["3", "3"]], [["0", "1"], ["0", "2"], ["1", "0"], ["1", "3"], ["2", "0"], ["2", "1"]], [["0", "0"], ["0", "3"], ["1", "2"], ["2", "1"], ["3", "0"], ["3", "2"]], [["0", "0"], ["0", "3"], ["1", "0"], ["1", "2"], ["2", "3"], ["3", "2"]], [["0", "1"], ["0", "2"], ["1", "1"], ["2", "0"], ["2", "2"], ["3", "0"]], [["1", "2"], ["1", "3"], ["2", "0"], ["2", "1"], ["3", "0"], ["3", "3"]], [["0", "2"], ["1", "1"], ["2", "2"], ["2", "3"], ["3", "1"], ["3", "3"]], [["0", "3"], ["1", "2"], ["1", "3"], ["2", "1"], ["3", "1"], ["3", "2"]], [["0", "0"], ["0", "1"], ["1", "2"], ["2", "0"], ["2", "3"], ["3", "2"]], [["0", "0"], ["0", "2"], ["0", "3"], ["1", "2"], ["2", "3"], ["3", "0"]], [["0", "0"], ["0", "2"], ["0", "3"], ["1", "3"], ["2", "2"], ["3", "0"]], [["0", "0"], ["0", "1"], ["0", "2"], ["1", "1"], ["2", "0"], ["3", "2"]], [["0", "0"], ["0", "1"], ["1", "1"], ["1", "3"], ["2", "1"], ["2", "2"]], [["0", "0"], ["0", "1"], ["2", "0"], ["2", "3"], ["3", "1"], ["3", "2"]]], "1": [[["0", "1"], ["0", "3"], ["1", "0"], ["1", "1"], ["3", "0"], ["3", "2"]], [["0", "1"], ["0", "3"], ["2", "1"], ["2", "2"], ["3", "0"], ["3", "1"]], [["0", "2"], ["1", "1"], ["1", "3"], ["2", "3"], ["3", "1"], ["3", "2"]], [["0", "0"], ["0", "1"], ["2", "2"], ["2", "3"], ["3", "1"], ["3", "2"]], [["0", "1"], ["1", "0"], ["1", "1"], ["1", "3"], ["2", "0"], ["3", "3"]], [["0", "0"], ["1", "2"], ["2", "0"], ["2", "3"], ["3", "2"], ["3", "3"]], [["0", "0"], ["0", "2"], ["1", "1"], ["1", "2"], ["3", "2"], ["3", "3"]], [["0", "2"], ["1", "1"], ["1", "2"], ["2", "1"], ["3", "0"], ["3", "3"]], [["0", "2"], ["1", "1"], ["2", "1"], ["2", "2"], ["2", "3"], ["3", "3"]], [["0", "1"], ["0", "3"], ["1", "3"], ["2", "1"], ["3", "0"], ["3", "2"]], [["0", "0"], ["0", "3"], ["2", "0"], ["2", "1"], ["3", "0"], ["3", "2"]], [["0", "0"], ["0", "3"], ["1", "0"], ["1", "1"], ["2", "2"], ["2", "3"]], [["0", "0"], ["0", "1"], ["1", "1"], ["1", "2"], ["2", "2"], ["2", "3"]], [["0", "0"], ["1", "1"], ["2", "3"], ["3", "0"], ["3", "1"], ["3", "2"]], [["0", "0"], ["0", "1"], ["2", "1"], ["2", "2"], ["3", "1"], ["3", "3"]], [["0", "2"], ["1", "3"], ["2", "0"], ["2", "2"], ["3", "0"], ["3", "3"]]], "2": [[["0", "0"], ["1", "1"], ["2", "0"], ["2", "2"], ["3", "1"], ["3", "2"]], [["0", "2"], ["0", "3"], ["1", "0"], ["2", "1"], ["2", "3"], ["3", "0"]], [["0", "0"], ["0", "2"], ["1", "1"], ["1", "3"], ["3", "2"], ["3", "3"]], [["0", "1"], ["1", "2"], ["2", "0"], ["2", "1"], ["2", "3"], ["3", "3"]], [["0", "0"], ["1", "3"], ["2", "0"], ["2", "3"], ["3", "1"], ["3", "2"]], [["0", "0"], ["0", "3"], ["1", "1"], ["2", "0"], ["2", "1"], ["3", "3"]], [["0", "0"], ["0", "1"], ["1", "1"], ["1", "3"], ["3", "0"], ["3", "2"]], [["0", "1"], ["0", "3"], ["1", "0"], ["2", "3"], ["3", "0"], ["3", "1"]], [["0", "3"], ["1", "2"], ["2", "1"], ["2", "2"], ["3", "1"], ["3", "3"]], [["0", "2"], ["0", "3"], ["1", "0"], ["1", "1"], ["3", "1"], ["3", "3"]], [["0", "1"], ["0", "2"], ["1", "0"], ["1", "2"], ["2", "0"], ["2", "3"]], [["1", "0"], ["1", "3"], ["2", "1"], ["2", "3"], ["3", "1"], ["3", "2"]], [["0", "1"], ["0", "3"], ["1", "2"], ["1", "3"], ["2", "0"], ["2", "3"]], [["0", "1"], ["0", "3"], ["1", "0"], ["2", "0"], ["2", "3"], ["3", "1"]], [["0", "1"], ["0", "2"], ["1", "0"], ["2", "0"], ["2", "3"], ["3", "3"]], [["0", "0"], ["1", "2"], ["1", "3"], ["2", "1"], ["2", "2"], ["3", "0"]]], "3": [[["0", "1"], ["0", "2"], ["1", "0"], ["2", "1"], ["3", "0"], ["3", "2"]], [["0", "0"], ["1", "1"], ["1", "2"], ["2", "1"], ["3", "0"], ["3", "2"]], [["0", "1"], ["1", "2"], ["1", "3"], ["2", "1"], ["3", "0"], ["3", "3"]], [["0", "0"], ["0", "2"], ["1", "1"], ["1", "2"], ["2", "0"], ["3", "1"]], [["0", "0"], ["0", "2"], ["1", "1"], ["1", "2"], ["2", "1"], ["2", "3"]], [["1", "1"], ["1", "2"], ["2", "0"], ["2", "3"], ["3", "1"], ["3", "3"]], [["1", "1"], ["1", "3"], ["2", "2"], ["2", "3"], ["3", "0"], ["3", "2"]], [["0", "1"], ["0", "2"], ["1", "2"], ["2", "0"], ["2", "3"], ["3", "1"]], [["0", "0"], ["0", "3"], ["1", "1"], ["2", "2"], ["2", "3"], ["3", "1"]], [["0", "1"], ["0", "2"], ["1", "3"], ["2", "0"], ["2", "2"], ["3", "3"]], [["0", "2"], ["0", "3"], ["1", "2"], ["2", "1"], ["2", "3"], ["3", "1"]], [["0", "1"], ["0", "3"], ["1", "0"], ["1", "2"], ["3", "0"], ["3", "1"]], [["0", "0"], ["0", "3"], ["1", "2"], ["1", "3"], ["2", "0"], ["2", "1"]], [["0", "0"], ["1", "3"], ["2", "0"], ["2", "1"], ["2", "2"], ["3", "2"]], [["0", "0"], ["0", "1"], ["0", "2"], ["1", "1"], ["2", "2"], ["3", "0"]], [["0", "3"], ["1", "0"], ["1", "2"], ["2", "1"], ["3", "1"], ["3", "3"]]], "4": [[["0", "2"], ["1", "3"], ["2", "1"], ["2", "3"], ["3", "1"], ["3", "2"]], [["0", "2"], ["1", "1"], ["1", "3"], ["2", "2"], ["3", "0"], ["3", "3"]], [["0", "3"], ["1", "1"], ["1", "3"], ["2", "1"], ["3", "0"], ["3", "2"]], [["0", "0"], ["0", "1"], ["1", "2"], ["1", "3"], ["2", "0"], ["2", "2"]], [["1", "0"], ["1", "2"], ["2", "0"], ["2", "3"], ["3", "0"], ["3", "1"]], [["0", "0"], ["0", "3"], ["1", "2"], ["1", "3"], ["2", "1"], ["3", "0"]], [["0", "0"], ["0", "1"], ["1", "1"], ["1", "3"], ["2", "0"], ["3", "3"]], [["0", "0"], ["1", "1"], ["2", "0"], ["2", "3"], ["3", "1"], ["3", "3"]], [["0", "0"], ["0", "3"], ["2", "1"], ["2", "2"], ["3", "0"], ["3", "1"]], [["0", "0"], ["0", "3"], ["1", "2"], ["1", "3"], ["3", "0"], ["3", "1"]], [["0", "2"], ["1", "0"], ["1", "3"], ["2", "2"], ["2", "3"], ["3", "0"]], [["0", "0"], ["0", "1"], ["2", "1"], ["2", "2"], ["3", "1"], ["3", "3"]], [["0", "1"], ["0", "2"], ["2", "1"], ["2", "3"], ["3", "0"], ["3", "2"]], [["0", "0"], ["0", "1"], ["1", "0"], ["1", "2"], ["2", "2"], ["3", "1"]], [["0", "0"], ["0", "2"], ["1", "3"], ["2", "3"], ["3", "1"], ["3", "2"]], [["0", "2"], ["1", "0"], ["2", "1"], ["2", "2"], ["3", "0"], ["3", "1"]]], "5": [[["0", "1"], ["0", "2"], ["1", "3"], ["2", "3"], ["3", "0"], ["3", "1"]], [["0", "0"], ["0", "1"], ["1", "2"], ["2", "1"], ["3", "0"], ["3", "2"]], [["0", "0"], ["0", "1"], ["1", "3"], ["2", "2"], ["2", "3"], ["3", "2"]], [["0", "0"], ["1", "0"], ["1", "2"], ["2", "3"], ["3", "2"], ["3", "3"]], [["0", "2"], ["1", "0"], ["2", "3"], ["3", "0"], ["3", "2"], ["3", "3"]], [["0", "1"], ["0", "2"], ["2", "2"], ["2", "3"], ["3", "0"], ["3", "2"]], [["1", "0"], ["1", "3"], ["2", "1"], ["2", "2"], ["3", "0"], ["3", "1"]], [["0", "2"], ["0", "3"], ["2", "0"], ["2", "1"], ["3", "1"], ["3", "2"]], [["0", "0"], ["0", "1"], ["1", "1"], ["2", "2"], ["3", "0"], ["3", "2"]], [["0", "0"], ["0", "1"], ["0", "2"], ["1", "2"], ["2", "0"], ["3", "3"]], [["0", "1"], ["0", "2"], ["1", "0"], ["1", "3"], ["2", "1"], ["3", "2"]], [["0", "0"], ["1", "1"], ["1", "2"], ["2", "0"], ["3", "2"], ["3", "3"]], [["0", "1"], ["0", "2"], ["1", "0"], ["1", "2"], ["2", "0"], ["3", "1"]], [["0", "2"], ["0", "3"], ["1", "3"], ["2", "1"], ["3", "1"], ["3", "2"]], [["0", "3"], ["1", "3"], ["2", "1"], ["2", "2"], ["3", "0"], ["3", "2"]], [["0", "3"], ["1", "0"], ["1", "2"], ["2", "0"], ["2", "1"], ["3", "3"]]], "6": [[["0", "2"], ["1", "0"], ["1", "1"], ["1", "2"], ["2", "1"], ["3", "0"]], [["0", "1"], ["0", "2"], ["1", "2"], ["1", "3"], ["2", "0"], ["3", "0"]], [["0", "1"], ["0", "2"], ["1", "3"], ["2", "3"], ["3", "0"], ["3", "2"]], [["0", "1"], ["1", "0"], ["1", "2"], ["2", "1"], ["3", "0"], ["3", "3"]], [["0", "0"], ["1", "3"], ["2", "2"], ["2", "3"], ["3", "1"], ["3", "2"]], [["0", "2"], ["0", "3"], ["1", "3"], ["2", "2"], ["3", "0"], ["3", "1"]], [["0", "1"], ["0", "3"], ["1", "1"], ["2", "3"], ["3", "0"], ["3", "2"]], [["0", "2"], ["0", "3"], ["1", "1"], ["2", "2"], ["3", "1"], ["3", "3"]], [["0", "0"], ["1", "3"], ["2", "0"], ["2", "3"], ["3", "1"], ["3", "2"]], [["0", "1"], ["1", "1"], ["1", "2"], ["1", "3"], ["2", "3"], ["3", "2"]], [["0", "0"], ["0", "2"], ["1", "0"], ["2", "2"], ["2", "3"], ["3", "3"]], [["0", "1"], ["0", "3"], ["1", "0"], ["1", "2"], ["3", "0"], ["3", "1"]], [["0", "1"], ["0", "3"], ["1", "3"], ["2", "1"], ["2", "2"], ["3", "2"]], [["0", "0"], ["0", "1"], ["1", "0"], ["1", "2"], ["2", "3"], ["3", "3"]], [["0", "1"], ["0", "2"], ["1", "2"], ["2", "3"], ["3", "1"], ["3", "3"]], [["0", "0"], ["0", "2"], ["2", "0"], ["2", "3"], ["3", "0"], ["3", "1"]]], "7": [[["0", "1"], ["0", "2"], ["1", "1"], ["1", "3"], ["2", "0"], ["2", "1"]], [["0", "1"], ["1", "2"], ["1", "3"], ["2", "1"], ["2", "2"], ["3", "3"]], [["0", "1"], ["1", "1"], ["1", "2"], ["1", "3"], ["2", "2"], ["3", "3"]], [["0", "1"], ["0", "2"], ["1", "2"], ["1", "3"], ["2", "0"], ["2", "3"]], [["1", "0"], ["1", "2"], ["2", "0"], ["2", "1"], ["3", "1"], ["3", "3"]], [["0", "2"], ["0", "3"], ["1", "0"], ["1", "1"], ["2", "0"], ["3", "1"]], [["0", "1"], ["0", "3"], ["1", "2"], ["1", "3"], ["2", "1"], ["3", "2"]], [["0", "3"], ["1", "1"], ["2", "0"], ["2", "3"], ["3", "0"], ["3", "1"]], [["0", "0"], ["0", "1"], ["2", "0"], ["2", "2"], ["3", "0"], ["3", "3"]], [["0", "1"], ["0", "3"], ["1", "3"], ["2", "0"], ["3", "0"], ["3", "1"]], [["0", "1"], ["0", "3"], ["1", "0"], ["1", "1"], ["2", "3"], ["3", "0"]], [["0", "1"], ["0", "2"], ["1", "0"], ["1", "1"], ["2", "3"], ["3", "3"]], [["0", "1"], ["0", "2"], ["1", "3"], ["2", "0"], ["3", "0"], ["3", "3"]], [["0", "0"], ["0", "3"], ["1", "0"], ["2", "2"], ["3", "0"], ["3", "1"]], [["0", "3"], ["1", "0"], ["1", "3"], ["2", "2"], ["3", "0"], ["3", "2"]], [["0", "0"], ["0", "1"], ["1", "2"], ["2", "0"], ["2", "3"], ["3", "2"]]], "8": [[["0", "1"], ["1", "0"], ["1", "2"], ["2", "2"], ["3", "0"], ["3", "1"]], [["0", "1"], ["0", "2"], ["1", "0"], ["2", "3"], ["3", "0"], ["3", "3"]], [["0", "0"], ["0", "3"], ["1", "1"], ["2", "1"], ["2", "3"], ["3", "0"]], [["0", "3"], ["1", "0"], ["2", "0"], ["2", "1"], ["2", "3"], ["3", "1"]], [["0", "0"], ["1", "0"], ["1", "1"], ["2", "1"], ["3", "2"], ["3", "3"]], [["0", "2"], ["1", "2"], ["2", "0"], ["2", "1"], ["3", "1"], ["3", "3"]], [["0", "1"], ["1", "1"], ["2", "0"], ["2", "2"], ["3", "2"], ["3", "3"]], [["0", "1"], ["0", "2"], ["1", "0"], ["2", "0"], ["2", "1"], ["3", "2"]], [["0", "1"], ["1", "0"], ["1", "3"], ["2", "2"], ["3", "1"], ["3", "2"]], [["0", "2"], ["1", "0"], ["1", "2"], ["2", "0"], ["2", "3"], ["3", "3"]], [["1", "0"], ["1", "2"], ["2", "1"], ["2", "2"], ["3", "1"], ["3", "3"]], [["0", "2"], ["0", "3"], ["1", "0"], ["2", "0"], ["3", "1"], ["3", "3"]], [["0", "0"], ["1", "0"], ["1", "3"], ["2", "1"], ["2", "3"], ["3", "1"]], [["0", "3"], ["1", "3"], ["2", "0"], ["2", "1"], ["3", "1"], ["3", "2"]], [["0", "2"], ["1", "1"], ["1", "3"], ["2", "0"], ["2", "3"], ["3", "0"]], [["0", "1"], ["0", "3"], ["1", "3"], ["2", "0"], ["2", "1"], ["3", "0"]]], "9": [[["0", "2"], ["1", "2"], ["2", "0"], ["2", "1"], ["3", "1"], ["3", "3"]], [["0", "0"], ["0", "2"], ["2", "0"], ["2", "1"], ["3", "0"], ["3", "3"]], [["0", "0"], ["1", "1"], ["1", "3"], ["2", "3"], ["3", "0"], ["3", "1"]], [["0", "1"], ["1", "1"], ["1", "2"], ["2", "0"], ["2", "2"], ["3", "0"]], [["0", "3"], ["1", "0"], ["1", "2"], ["2", "0"], ["2", "3"], ["3", "1"]], [["0", "2"], ["0", "3"], ["1", "2"], ["2", "3"], ["3", "0"], ["3", "1"]], [["1", "0"], ["1", "3"], ["2", "0"], ["2", "1"], ["3", "0"], ["3", "2"]], [["0", "0"], ["0", "3"], ["2", "0"], ["2", "1"], ["3", "0"], ["3", "2"]], [["0", "2"], ["1", "0"], ["1", "1"], ["2", "3"], ["3", "2"], ["3", "3"]], [["1", "0"], ["1", "3"], ["2", "0"], ["2", "2"], ["3", "1"], ["3", "3"]], [["0", "1"], ["1", "2"], ["2", "3"], ["3", "1"], ["3", "2"], ["3", "3"]], [["0", "0"], ["1", "0"], ["1", "2"], ["2", "2"], ["3", "1"], ["3", "3"]], [["0", "1"], ["0", "2"], ["0", "3"], ["1", "3"], ["2", "2"], ["3", "1"]], [["1", "1"], ["1", "3"], ["2", "1"], ["2", "2"], ["3", "0"], ["3", "1"]], [["0", "2"], ["0", "3"], ["1", "1"], ["1", "2"], ["3", "0"], ["3", "2"]], [["0", "1"], ["1", "2"], ["2", "0"], ["2", "1"], ["3", "0"], ["3", "2"]]], "10": [[["0", "0"], ["0", "2"], ["1", "0"], ["2", "3"], ["3", "2"], ["3", "3"]], [["0", "0"], ["0", "3"], ["1", "0"], ["1", "1"], ["2", "3"], ["3", "1"]], [["0", "1"], ["0", "3"], ["1", "0"], ["1", "3"], ["2", "0"], ["2", "2"]], [["0", "2"], ["0", "3"], ["1", "0"], ["1", "1"], ["2", "1"], ["3", "3"]], [["0", "1"], ["1", "0"], ["1", "1"], ["2", "2"], ["2", "3"], ["3", "0"]], [["0", "2"], ["1", "0"], ["2", "2"], ["2", "3"], ["3", "0"], ["3", "3"]], [["0", "1"], ["0", "2"], ["1", "0"], ["1", "3"], ["2", "0"], ["3", "3"]], [["0", "0"], ["0", "2"], ["1", "1"], ["2", "3"], ["3", "1"], ["3", "3"]], [["0", "1"], ["1", "0"], ["1", "2"], ["2", "0"], ["2", "1"], ["3", "2"]], [["0", "0"], ["0", "3"], ["1", "0"], ["1", "2"], ["2", "1"], ["2", "2"]], [["0", "2"], ["0", "3"], ["1", "1"], ["2", "0"], ["2", "3"], ["3", "1"]], [["0", "0"], ["1", "1"], ["1", "2"], ["2", "0"], ["3", "1"], ["3", "3"]], [["0", "1"], ["0", "2"], ["1", "1"], ["2", "2"], ["2", "3"], ["3", "3"]], [["1", "0"], ["1", "2"], ["2", "0"], ["2", "1"], ["3", "2"], ["3", "3"]], [["0", "3"], ["1", "0"], ["2", "0"], ["2", "1"], ["3", "1"], ["3", "3"]], [["0", "0"], ["1", "1"], ["1", "2"], ["2", "0"], ["2", "2"], ["3", "1"]]], "11": [[["1", "1"], ["1", "2"], ["2", "0"], ["2", "2"], ["3", "2"], ["3", "3"]], [["0", "2"], ["0", "3"], ["1", "0"], ["1", "2"], ["2", "1"], ["3", "2"]], [["0", "2"], ["0", "3"], ["1", "2"], ["2", "0"], ["2", "1"], ["3", "3"]], [["0", "1"], ["0", "3"], ["1", "3"], ["2", "0"], ["2", "2"], ["3", "1"]], [["0", "0"], ["0", "3"], ["1", "1"], ["1", "2"], ["2", "1"], ["3", "2"]], [["0", "0"], ["0", "3"], ["1", "1"], ["1", "3"], ["2", "0"], ["3", "1"]], [["0", "1"], ["0", "3"], ["2", "2"], ["2", "3"], ["3", "0"], ["3", "2"]], [["0", "0"], ["0", "2"], ["1", "1"], ["1", "2"], ["2", "3"], ["3", "3"]], [["0", "1"], ["1", "1"], ["1", "2"], ["2", "2"], ["2", "3"], ["3", "3"]], [["1", "1"], ["1", "3"], ["2", "2"], ["2", "3"], ["3", "0"], ["3", "2"]], [["0", "2"], ["1", "1"], ["1", "3"], ["2", "0"], ["2", "3"], ["3", "2"]], [["0", "0"], ["1", "2"], ["2", "1"], ["3", "0"], ["3", "1"], ["3", "2"]], [["0", "1"], ["1", "0"], ["2", "1"], ["2", "2"], ["3", "0"], ["3", "2"]], [["0", "1"], ["0", "2"], ["1", "2"], ["1", "3"], ["3", "0"], ["3", "2"]], [["0", "1"], ["0", "2"], ["2", "1"], ["2", "3"], ["3", "0"], ["3", "3"]], [["0", "3"], ["1", "1"], ["1", "3"], ["2", "0"], ["3", "0"], ["3", "1"]]], "12": [[["0", "1"], ["0", "3"], ["1", "1"], ["1", "2"], ["3", "0"], ["3", "1"]], [["0", "1"], ["1", "0"], ["2", "2"], ["2", "3"], ["3", "2"], ["3", "3"]], [["0", "2"], ["1", "0"], ["1", "1"], ["2", "2"], ["3", "1"], ["3", "3"]], [["0", "3"], ["1", "1"], ["1", "2"], ["2", "0"], ["2", "2"], ["3", "3"]], [["0", "0"], ["0", "1"], ["1", "1"], ["1", "3"], ["3", "2"], ["3", "3"]], [["0", "0"], ["0", "2"], ["1", "1"], ["1", "3"], ["2", "0"], ["3", "2"]], [["0", "0"], ["1", "1"], ["2", "0"], ["2", "2"], ["3", "1"], ["3", "2"]], [["0", "2"], ["0", "3"], ["1", "1"], ["2", "3"], ["3", "1"], ["3", "2"]], [["0", "0"], ["0", "1"], ["2", "2"], ["2", "3"], ["3", "1"], ["3", "2"]], [["0", "2"], ["0", "3"], ["2", "0"], ["2", "2"], ["3", "1"], ["3", "2"]], [["0", "0"], ["1", "0"], ["2", "1"], ["2", "2"], ["3", "1"], ["3", "3"]], [["0", "3"], ["1", "0"], ["1", "2"], ["2", "0"], ["2", "3"], ["3", "2"]], [["0", "3"], ["1", "0"], ["1", "3"], ["2", "0"], ["3", "1"], ["3", "2"]], [["0", "1"], ["0", "3"], ["1", "0"], ["1", "2"], ["3", "0"], ["3", "3"]], [["0", "1"], ["0", "2"], ["2", "0"], ["2", "3"], ["3", "0"], ["3", "1"]], [["0", "1"], ["0", "2"], ["2", "2"], ["2", "3"], ["3", "0"], ["3", "1"]]], "13": [[["0", "1"], ["0", "3"], ["2", "0"], ["2", "2"], ["3", "1"], ["3", "2"]], [["0", "0"], ["0", "1"], ["1", "0"], ["1", "3"], ["2", "2"], ["3", "2"]], [["0", "1"], ["0", "3"], ["2", "1"], ["2", "2"], ["3", "0"], ["3", "2"]], [["0", "3"], ["1", "0"], ["1", "2"], ["2", "0"], ["3", "2"], ["3", "3"]], [["0", "0"], ["1", "1"], ["2", "1"], ["2", "2"], ["3", "0"], ["3", "2"]], [["1", "2"], ["1", "3"], ["2", "0"], ["2", "1"], ["3", "1"], ["3", "3"]], [["1", "2"], ["1", "3"], ["2", "1"], ["2", "3"], ["3", "0"], ["3", "1"]], [["0", "0"], ["1", "1"], ["1", "3"], ["2", "1"], ["2", "2"], ["3", "3"]], [["0", "0"], ["0", "3"], ["2", "0"], ["2", "2"], ["3", "0"], ["3", "1"]], [["0", "0"], ["0", "1"], ["0", "2"], ["1", "0"], ["2", "2"], ["3", "1"]], [["0", "1"], ["0", "2"], ["1", "1"], ["2", "2"], ["2", "3"], ["3", "3"]], [["0", "0"], ["0", "2"], ["1", "0"], ["2", "1"], ["2", "3"], ["3", "2"]], [["0", "0"], ["1", "1"], ["1", "3"], ["2", "0"], ["3", "2"], ["3", "3"]], [["0", "1"], ["0", "2"], ["1", "3"], ["2", "1"], ["3", "2"], ["3", "3"]], [["0", "1"], ["1", "0"], ["2", "1"], ["2", "2"], ["3", "0"], ["3", "2"]], [["0", "1"], ["1", "0"], ["1", "2"], ["2", "1"], ["3", "0"], ["3", "3"]]], "14": [[["0", "1"], ["0", "3"], ["2", "2"], ["2", "3"], ["3", "0"], ["3", "3"]], [["0", "1"], ["1", "0"], ["1", "3"], ["2", "1"], ["2", "3"], ["3", "0"]], [["0", "1"], ["0", "2"], ["1", "0"], ["1", "1"], ["2", "2"], ["2", "3"]], [["0", "1"], ["0", "2"], ["1", "1"], ["1", "3"], ["2", "0"], ["3", "0"]], [["0", "1"], ["1", "1"], ["1", "2"], ["2", "2"], ["3", "0"], ["3", "3"]], [["0", "1"], ["0", "2"], ["1", "2"], ["1", "3"], ["3", "0"], ["3", "2"]], [["0", "1"], ["1", "0"], ["2", "0"], ["2", "1"], ["2", "3"], ["3", "3"]], [["0", "1"], ["0", "2"], ["1", "3"], ["2", "3"], ["3", "0"], ["3", "1"]], [["0", "0"], ["0", "1"], ["2", "0"], ["2", "2"], ["3", "0"], ["3", "3"]], [["0", "0"], ["0", "2"], ["1", "1"], ["2", "1"], ["3", "2"], ["3", "3"]], [["0", "1"], ["0", "3"], ["1", "0"], ["1", "3"], ["3", "1"], ["3", "2"]], [["0", "2"], ["0", "3"], ["1", "2"], ["2", "1"], ["3", "0"], ["3", "3"]], [["0", "1"], ["0", "2"], ["1", "0"], ["2", "2"], ["2", "3"], ["3", "0"]], [["1", "1"], ["1", "3"], ["2", "1"], ["2", "2"], ["3", "0"], ["3", "3"]], [["0", "0"], ["0", "1"], ["1", "0"], ["1", "2"], ["2", "1"], ["3", "2"]], [["0", "3"], ["1", "2"], ["1", "3"], ["2", "2"], ["3", "0"], ["3", "1"]]], "15": [[["0", "1"], ["1", "3"], ["2", "1"], ["2", "2"], ["2", "3"], ["3", "0"]], [["0", "0"], ["1", "1"], ["2", "1"], ["2", "2"], ["3", "0"], ["3", "2"]], [["0", "2"], ["1", "2"], ["2", "1"], ["2", "3"], ["3", "0"], ["3", "3"]], [["0", "0"], ["0", "2"], ["1", "1"], ["2", "1"], ["3", "2"], ["3", "3"]], [["0", "1"], ["0", "3"], ["1", "1"], ["2", "0"], ["3", "0"], ["3", "3"]], [["0", "0"], ["0", "3"], ["1", "0"], ["1", "2"], ["2", "1"], ["3", "1"]], [["0", "1"], ["0", "3"], ["1", "2"], ["2", "0"], ["2", "2"], ["3", "0"]], [["0", "2"], ["1", "1"], ["2", "1"], ["2", "3"], ["3", "2"], ["3", "3"]], [["0", "0"], ["1", "0"], ["2", "1"], ["2", "3"], ["3", "2"], ["3", "3"]], [["0", "1"], ["0", "2"], ["1", "1"], ["1", "3"], ["2", "0"], ["2", "1"]], [["1", "1"], ["1", "3"], ["2", "0"], ["2", "2"], ["3", "2"], ["3", "3"]], [["0", "0"], ["0", "3"], ["1", "1"], ["1", "2"], ["2", "3"], ["3", "0"]], [["0", "3"], ["1", "0"], ["1", "2"], ["2", "3"], ["3", "0"], ["3", "1"]], [["0", "1"], ["0", "3"], ["1", "0"], ["1", "2"], ["2", "3"], ["3", "1"]], [["0", "2"], ["1", "2"], ["1", "3"], ["2", "1"], ["2", "3"], ["3", "1"]], [["0", "1"], ["1", "0"], ["1", "2"], ["2", "0"], ["3", "1"], ["3", "2"]]], "16": [[["0", "3"], ["1", "2"], ["2", "1"], ["2", "3"], ["3", "1"], ["3", "2"]], [["0", "1"], ["0", "3"], ["2", "1"], ["2", "2"], ["3", "0"], ["3", "2"]], [["0", "0"], ["0", "2"], ["0", "3"], ["1", "2"], ["2", "3"], ["3", "0"]], [["0", "2"], ["1", "0"], ["1", "2"], ["2", "3"], ["3", "0"], ["3", "3"]], [["0", "0"], ["0", "2"], ["1", "1"], ["1", "3"], ["3", "2"], ["3", "3"]], [["0", "0"], ["1", "2"], ["1", "3"], ["2", "0"], ["2", "1"], ["3", "1"]], [["0", "1"], ["1", "2"], ["2", "2"], ["2", "3"], ["3", "1"], ["3", "3"]], [["1", "2"], ["1", "3"], ["2", "1"], ["2", "2"], ["3", "0"], ["3", "2"]], [["0", "0"], ["1", "2"], ["2", "0"], ["2", "1"], ["3", "1"], ["3", "2"]], [["0", "0"], ["0", "3"], ["1", "1"], ["1", "3"], ["2", "1"], ["2", "2"]], [["0", "3"], ["1", "0"], ["1", "1"], ["2", "3"], ["3", "0"], ["3", "2"]], [["0", "2"], ["0", "3"], ["1", "0"], ["1", "2"], ["2", "1"], ["2", "3"]], [["0", "2"], ["1", "2"], ["1", "3"], ["2", "1"], ["3", "1"], ["3", "3"]], [["0", "0"], ["0", "1"], ["1", "2"], ["1", "3"], ["3", "1"], ["3", "2"]], [["0", "2"], ["0", "3"], ["2", "0"], ["2", "3"], ["3", "0"], ["3", "1"]], [["0", "3"], ["1", "0"], ["1", "2"], ["2", "0"], ["2", "3"], ["3", "1"]]], "17": [[["1", "1"], ["1", "3"], ["2", "0"], ["2", "3"], ["3", "1"], ["3", "2"]], [["0", "1"], ["0", "3"], ["1", "1"], ["1", "2"], ["2", "0"], ["2", "3"]], [["0", "0"], ["0", "2"], ["1", "3"], ["2", "2"], ["3", "0"], ["3", "3"]], [["0", "0"], ["0", "1"], ["1", "3"], ["2", "2"], ["3", "2"], ["3", "3"]], [["0", "2"], ["1", "1"], ["1", "3"], ["2", "3"], ["3", "1"], ["3", "2"]], [["0", "2"], ["1", "0"], ["1", "3"], ["2", "2"], ["3", "1"], ["3", "3"]], [["0", "2"], ["1", "0"], ["1", "2"], ["2", "0"], ["3", "1"], ["3", "3"]], [["0", "2"], ["0", "3"], ["1", "1"], ["1", "3"], ["2", "0"], ["3", "1"]], [["0", "3"], ["1", "0"], ["1", "1"], ["2", "3"], ["3", "0"], ["3", "2"]], [["0", "1"], ["0", "2"], ["0", "3"], ["1", "2"], ["2", "1"], ["3", "3"]], [["0", "0"], ["0", "2"], ["0", "3"], ["1", "3"], ["2", "2"], ["3", "0"]], [["0", "0"], ["0", "1"], ["1", "0"], ["1", "2"], ["2", "2"], ["3", "1"]], [["0", "3"], ["1", "0"], ["1", "2"], ["2", "1"], ["2", "3"], ["3", "1"]], [["0", "3"], ["1", "0"], ["1", "3"], ["2", "1"], ["2", "2"], ["3", "0"]], [["0", "0"], ["0", "3"], ["2", "0"], ["2", "2"], ["3", "0"], ["3", "1"]], [["0", "1"], ["0", "3"], ["1", "3"], ["2", "2"], ["3", "1"], ["3", "2"]]], "18": [[["0", "2"], ["0", "3"], ["1", "0"], ["2", "0"], ["2", "3"], ["3", "2"]], [["0", "1"], ["0", "3"], ["1", "1"], ["2", "2"], ["3", "2"], ["3", "3"]], [["0", "2"], ["0", "3"], ["1", "1"], ["1", "2"], ["3", "0"], ["3", "1"]], [["0", "2"], ["0", "3"], ["1", "0"], ["1", "1"], ["2", "1"], ["2", "2"]], [["0", "2"], ["0", "3"], ["1", "1"], ["2", "1"], ["2", "3"], ["3", "2"]], [["0", "1"], ["1", "2"], ["2", "1"], ["2", "2"], ["2", "3"], ["3", "3"]], [["0", "0"], ["0", "2"], ["1", "0"], ["1", "3"], ["2", "1"], ["2", "3"]], [["0", "2"], ["1", "3"], ["2", "2"], ["2", "3"], ["3", "0"], ["3", "1"]], [["0", "0"], ["0", "3"], ["1", "2"], ["2", "2"], ["3", "0"], ["3", "1"]], [["0", "1"], ["1", "0"], ["1", "2"], ["2", "1"], ["2", "2"], ["3", "0"]], [["0", "0"], ["0", "3"], ["1", "0"], ["2", "2"], ["2", "3"], ["3", "2"]], [["0", "2"], ["1", "1"], ["1", "3"], ["2", "0"], ["3", "2"], ["3", "3"]], [["0", "1"], ["0", "3"], ["1", "1"], ["1", "2"], ["3", "0"], ["3", "1"]], [["0", "3"], ["1", "1"], ["1", "2"], ["2", "0"], ["3", "0"], ["3", "3"]], [["0", "2"], ["0", "3"], ["1", "0"], ["1", "2"], ["3", "1"], ["3", "2"]], [["0", "1"], ["0", "2"], ["1", "0"], ["2", "1"], ["3", "0"], ["3", "2"]]], "19": [[["0", "1"], ["1", "1"], ["2", "2"], ["2", "3"], ["3", "0"], ["3", "2"]], [["0", "0"], ["0", "3"], ["1", "0"], ["1", "2"], ["2", "0"], ["3", "1"]], [["0", "2"], ["1", "0"], ["1", "1"], ["2", "2"], ["3", "1"], ["3", "3"]], [["0", "1"], ["1", "2"], ["1", "3"], ["2", "1"], ["3", "0"], ["3", "2"]], [["0", "1"], ["0", "2"], ["1", "0"], ["1", "1"], ["2", "0"], ["2", "3"]], [["0", "1"], ["0", "2"], ["2", "2"], ["2", "3"], ["3", "0"], ["3", "1"]], [["0", "2"], ["0", "3"], ["1", "0"], ["2", "1"], ["2", "2"], ["3", "0"]], [["0", "0"], ["1", "1"], ["1", "3"], ["2", "0"], ["2", "2"], ["3", "2"]], [["0", "2"], ["0", "3"], ["1", "1"], ["2", "0"], ["3", "0"], ["3", "1"]], [["0", "0"], ["0", "3"], ["2", "0"], ["2", "2"], ["3", "1"], ["3", "3"]], [["0", "0"], ["0", "1"], ["2", "2"], ["2", "3"], ["3", "0"], ["3", "3"]], [["0", "1"], ["0", "2"], ["1", "0"], ["1", "2"], ["3", "2"], ["3", "3"]], [["0", "1"], ["0", "3"], ["1", "0"], ["1", "2"], ["2", "0"], ["3", "2"]], [["0", "0"], ["0", "2"], ["1", "0"], ["1", "3"], ["2", "1"], ["3", "1"]], [["0", "3"], ["1", "1"], ["1", "3"], ["2", "0"], ["2", "1"], ["3", "0"]], [["0", "2"], ["1", "0"], ["1", "2"], ["2", "0"], ["2", "1"], ["3", "1"]]], "20": [[["0", "2"], ["0", "3"], ["1", "0"], ["2", "1"], ["2", "3"], ["3", "0"]], [["0", "0"], ["0", "2"], ["2", "0"], ["2", "3"], ["3", "1"], ["3", "3"]], [["0", "1"], ["0", "3"], ["1", "0"], ["2", "1"], ["2", "2"], ["3", "3"]], [["0", "0"], ["0", "1"], ["1", "1"], ["1", "2"], ["2", "1"], ["2", "3"]], [["0", "2"], ["0", "3"], ["2", "0"], ["2", "3"], ["3", "0"], ["3", "1"]], [["0", "1"], ["0", "2"], ["1", "0"], ["2", "0"], ["3", "1"], ["3", "3"]], [["0", "0"], ["1", "0"], ["2", "1"], ["2", "2"], ["3", "1"], ["3", "3"]], [["0", "2"], ["1", "1"], ["1", "3"], ["2", "1"], ["2", "2"], ["3", "3"]], [["0", "2"], ["1", "1"], ["1", "2"], ["2", "0"], ["2", "3"], ["3", "1"]], [["0", "1"], ["0", "2"], ["1", "0"], ["2", "0"], ["2", "3"], ["3", "3"]], [["0", "0"], ["0", "1"], ["1", "0"], ["1", "3"], ["3", "2"], ["3", "3"]], [["0", "1"], ["0", "3"], ["1", "0"], ["1", "2"], ["2", "0"], ["2", "3"]], [["0", "0"], ["0", "1"], ["1", "0"], ["1", "3"], ["2", "2"], ["2", "3"]], [["0", "0"], ["0", "2"], ["1", "2"], ["2", "0"], ["2", "3"], ["3", "3"]], [["0", "0"], ["0", "2"], ["1", "2"], ["2", "0"], ["3", "1"], ["3", "3"]], [["0", "0"], ["0", "1"], ["1", "0"], ["2", "1"], ["3", "2"], ["3", "3"]]], "21": [[["0", "0"], ["1", "0"], ["1", "1"], ["2", "1"], ["2", "3"], ["3", "3"]], [["1", "1"], ["1", "3"], ["2", "0"], ["2", "1"], ["3", "0"], ["3", "2"]], [["0", "1"], ["0", "2"], ["1", "1"], ["1", "3"], ["2", "0"], ["2", "2"]], [["0", "3"], ["1", "2"], ["2", "1"], ["2", "3"], ["3", "1"], ["3", "2"]], [["1", "2"], ["1", "3"], ["2", "1"], ["2", "3"], ["3", "0"], ["3", "2"]], [["0", "1"], ["0", "3"], ["1", "0"], ["1", "2"], ["3", "2"], ["3", "3"]], [["1", "2"], ["1", "3"], ["2", "0"], ["2", "3"], ["3", "0"], ["3", "1"]], [["0", "0"], ["0", "2"], ["1", "0"], ["1", "3"], ["2", "1"], ["3", "1"]], [["0", "1"], ["1", "1"], ["1", "2"], ["1", "3"], ["2", "3"], ["3", "2"]], [["0", "0"], ["0", "2"], ["1", "1"], ["1", "3"], ["2", "2"], ["3", "0"]], [["0", "2"], ["0", "3"], ["1", "3"], ["2", "1"], ["3", "0"], ["3", "1"]], [["0", "0"], ["0", "3"], ["1", "0"], ["1", "2"], ["3", "0"], ["3", "1"]], [["0", "0"], ["0", "2"], ["0", "3"], ["1", "2"], ["2", "3"], ["3", "0"]], [["1", "0"], ["1", "3"], ["2", "2"], ["2", "3"], ["3", "1"], ["3", "3"]], [["0", "1"], ["0", "3"], ["1", "0"], ["2", "0"], ["2", "3"], ["3", "1"]], [["0", "3"], ["1", "1"], ["1", "2"], ["2", "3"], ["3", "0"], ["3", "1"]]], "22": [[["0", "0"], ["1", "1"], ["1", "2"], ["2", "0"], ["3", "2"], ["3", "3"]], [["0", "2"], ["0", "3"], ["2", "0"], ["2", "1"], ["3", "0"], ["3", "3"]], [["0", "1"], ["0", "3"], ["1", "1"], ["1", "2"], ["2", "0"], ["2", "1"]], [["0", "1"], ["0", "3"], ["1", "1"], ["1", "2"], ["3", "0"], ["3", "2"]], [["0", "1"], ["0", "2"], ["1", "0"], ["1", "2"], ["2", "1"], ["2", "3"]], [["0", "1"], ["0", "2"], ["1", "1"], ["2", "2"], ["3", "0"], ["3", "3"]], [["0", "0"], ["0", "3"], ["1", "2"], ["1", "3"], ["2", "1"], ["2", "3"]], [["0", "0"], ["0", "3"], ["1", "1"], ["1", "3"], ["2", "1"], ["2", "2"]], [["0", "0"], ["0", "2"], ["1", "2"], ["1", "3"], ["2", "3"], ["3", "0"]], [["0", "3"], ["1", "0"], ["1", "1"], ["2", "0"], ["3", "1"], ["3", "3"]], [["0", "1"], ["0", "3"], ["2", "0"], ["2", "2"], ["3", "1"], ["3", "2"]], [["0", "0"], ["0", "2"], ["1", "3"], ["2", "2"], ["3", "0"], ["3", "3"]], [["0", "0"], ["0", "2"], ["1", "0"], ["1", "1"], ["2", "2"], ["3", "1"]], [["0", "1"], ["1", "2"], ["1", "3"], ["2", "3"], ["3", "0"], ["3", "2"]], [["0", "0"], ["0", "1"], ["2", "0"], ["2", "2"], ["3", "1"], ["3", "3"]], [["0", "1"], ["0", "2"], ["0", "3"], ["1", "3"], ["2", "1"], ["3", "2"]]], "23": [[["0", "2"], ["1", "0"], ["1", "3"], ["2", "1"], ["2", "3"], ["3", "2"]], [["0", "0"], ["0", "1"], ["0", "3"], ["1", "1"], ["2", "0"], ["3", "3"]], [["0", "2"], ["1", "1"], ["2", "1"], ["2", "2"], ["3", "0"], ["3", "3"]], [["0", "0"], ["0", "3"], ["1", "3"], ["2", "1"], ["3", "0"], ["3", "1"]], [["0", "3"], ["1", "3"], ["2", "0"], ["2", "1"], ["3", "1"], ["3", "2"]], [["1", "0"], ["1", "1"], ["2", "0"], ["2", "3"], ["3", "1"], ["3", "2"]], [["0", "2"], ["0", "3"], ["1", "2"], ["2", "3"], ["3", "0"], ["3", "1"]], [["0", "0"], ["0", "3"], ["1", "1"], ["1", "3"], ["3", "1"], ["3", "2"]], [["0", "3"], ["1", "1"], ["1", "3"], ["2", "0"], ["3", "0"], ["3", "1"]], [["0", "2"], ["0", "3"], ["1", "0"], ["1", "3"], ["3", "1"], ["3", "3"]], [["0", "3"], ["1", "1"], ["1", "2"], ["2", "1"], ["2", "3"], ["3", "2"]], [["0", "0"], ["0", "2"], ["1", "1"], ["2", "2"], ["2", "3"], ["3", "0"]], [["0", "2"], ["1", "0"], ["1", "1"], ["2", "2"], ["2", "3"], ["3", "3"]], [["0", "0"], ["0", "2"], ["1", "2"], ["2", "0"], ["3", "1"], ["3", "3"]], [["0", "1"], ["0", "3"], ["1", "2"], ["1", "3"], ["2", "1"], ["3", "2"]], [["0", "3"], ["1", "0"], ["1", "2"], ["2", "1"], ["3", "1"], ["3", "3"]]], "24": [[["0", "0"], ["1", "1"], ["2", "0"], ["2", "1"], ["3", "2"], ["3", "3"]], [["0", "1"], ["0", "2"], ["1", "0"], ["1", "1"], ["2", "2"], ["2", "3"]], [["0", "1"], ["0", "3"], ["1", "2"], ["1", "3"], ["3", "0"], ["3", "1"]], [["0", "3"], ["1", "0"], ["1", "1"], ["2", "0"], ["2", "2"], ["3", "3"]], [["0", "2"], ["0", "3"], ["1", "0"], ["1", "1"], ["2", "1"], ["2", "2"]], [["0", "0"], ["0", "1"], ["2", "1"], ["2", "3"], ["3", "0"], ["3", "2"]], [["0", "1"], ["1", "0"], ["1", "1"], ["1", "3"], ["2", "0"], ["3", "3"]], [["0", "2"], ["1", "0"], ["1", "3"], ["2", "2"], ["3", "1"], ["3", "3"]], [["0", "1"], ["1", "1"], ["2", "0"], ["2", "2"], ["3", "0"], ["3", "3"]], [["0", "1"], ["0", "2"], ["1", "0"], ["1", "2"], ["2", "3"], ["3", "3"]], [["0", "1"], ["0", "2"], ["1", "0"], ["1", "3"], ["3", "1"], ["3", "3"]], [["0", "2"], ["0", "3"], ["2", "1"], ["2", "2"], ["3", "0"], ["3", "1"]], [["0", "0"], ["0", "1"], ["1", "2"], ["1", "3"], ["2", "0"], ["2", "2"]], [["0", "1"], ["0", "2"], ["2", "0"], ["2", "2"], ["3", "0"], ["3", "3"]], [["0", "1"], ["0", "2"], ["1", "1"], ["1", "3"], ["2", "3"], ["3", "2"]], [["0", "0"], ["0", "2"], ["1", "1"], ["2", "3"], ["3", "0"], ["3", "2"]]], "25": [[["0", "3"], ["1", "2"], ["1", "3"], ["2", "1"], ["2", "2"], ["3", "1"]], [["0", "1"], ["0", "3"], ["1", "0"], ["2", "0"], ["3", "2"], ["3", "3"]], [["0", "0"], ["0", "2"], ["0", "3"], ["1", "3"], ["2", "2"], ["3", "0"]], [["0", "0"], ["0", "2"], ["1", "2"], ["2", "1"], ["2", "3"], ["3", "0"]], [["0", "0"], ["1", "0"], ["1", "1"], ["1", "3"], ["2", "2"], ["3", "3"]], [["0", "1"], ["1", "2"], ["2", "0"], ["2", "1"], ["3", "0"], ["3", "2"]], [["0", "0"], ["0", "2"], ["1", "3"], ["2", "3"], ["3", "0"], ["3", "1"]], [["0", "2"], ["0", "3"], ["1", "0"], ["2", "1"], ["2", "3"], ["3", "0"]], [["0", "2"], ["0", "3"], ["1", "0"], ["1", "1"], ["2", "0"], ["3", "1"]], [["1", "1"], ["1", "3"], ["2", "0"], ["2", "2"], ["3", "2"], ["3", "3"]], [["0", "0"], ["0", "1"], ["0", "3"], ["1", "0"], ["2", "1"], ["3", "3"]], [["0", "2"], ["0", "3"], ["1", "1"], ["1", "3"], ["3", "0"], ["3", "2"]], [["0", "3"], ["1", "0"], ["2", "0"], ["2", "3"], ["3", "1"], ["3", "2"]], [["0", "0"], ["1", "1"], ["2", "2"], ["3", "0"], ["3", "1"], ["3", "2"]], [["0", "0"], ["0", "1"], ["1", "0"], ["2", "1"], ["3", "2"], ["3", "3"]], [["0", "1"], ["0", "3"], ["2", "0"], ["2", "2"], ["3", "0"], ["3", "1"]]], "26": [[["0", "2"], ["1", "1"], ["1", "2"], ["1", "3"], ["2", "3"], ["3", "1"]], [["0", "0"], ["0", "1"], ["1", "0"], ["2", "2"], ["3", "1"], ["3", "2"]], [["0", "2"], ["0", "3"], ["1", "3"], ["2", "1"], ["3", "1"], ["3", "2"]], [["0", "3"], ["1", "0"], ["2", "0"], ["2", "1"], ["3", "1"], ["3", "2"]], [["0", "0"], ["0", "2"], ["1", "2"], ["2", "3"], ["3", "0"], ["3", "3"]], [["0", "0"], ["1", "0"], ["1", "3"], ["2", "3"], ["3", "1"], ["3", "2"]], [["0", "0"], ["0", "3"], ["1", "3"], ["2", "1"], ["2", "2"], ["3", "0"]], [["0", "2"], ["1", "1"], ["1", "3"], ["2", "2"], ["3", "0"], ["3", "3"]], [["0", "0"], ["1", "2"], ["1", "3"], ["2", "0"], ["3", "1"], ["3", "3"]], [["0", "0"], ["0", "1"], ["1", "0"], ["1", "3"], ["2", "1"], ["2", "2"]], [["0", "0"], ["1", "1"], ["1", "3"], ["2", "0"], ["3", "1"], ["3", "2"]], [["0", "3"], ["1", "1"], ["1", "2"], ["2", "3"], ["3", "0"], ["3", "2"]], [["0", "1"], ["0", "3"], ["1", "0"], ["1", "1"], ["3", "2"], ["3", "3"]], [["0", "0"], ["0", "3"], ["1", "0"], ["1", "1"], ["3", "1"], ["3", "2"]], [["0", "0"], ["1", "3"], ["2", "0"], ["2", "2"], ["3", "2"], ["3", "3"]], [["0", "1"], ["0", "2"], ["1", "0"], ["1", "3"], ["2", "2"], ["2", "3"]]], "27": [[["0", "2"], ["1", "1"], ["2", "1"], ["2", "2"], ["3", "0"], ["3", "3"]], [["0", "0"], ["0", "3"], ["1", "1"], ["1", "2"], ["2", "1"], ["3", "2"]], [["0", "2"], ["0", "3"], ["1", "0"], ["1", "1"], ["3", "0"], ["3", "3"]], [["0", "2"], ["1", "3"], ["2", "0"], ["2", "2"], ["3", "0"], ["3", "3"]], [["0", "3"], ["1", "2"], ["2", "1"], ["2", "2"], ["3", "1"], ["3", "3"]], [["0", "0"], ["1", "2"], ["2", "0"], ["2", "2"], ["2", "3"], ["3", "3"]], [["0", "1"], ["1", "0"], ["1", "3"], ["2", "2"], ["3", "1"], ["3", "2"]], [["0", "3"], ["1", "1"], ["1", "2"], ["2", "2"], ["3", "1"], ["3", "3"]], [["0", "0"], ["0", "2"], ["1", "0"], ["1", "1"], ["3", "1"], ["3", "3"]], [["0", "2"], ["0", "3"], ["1", "0"], ["1", "2"], ["3", "1"], ["3", "2"]], [["0", "1"], ["1", "2"], ["2", "0"], ["2", "1"], ["2", "2"], ["3", "0"]], [["0", "2"], ["0", "3"], ["1", "1"], ["2", "0"], ["3", "0"], ["3", "1"]], [["0", "0"], ["0", "3"], ["1", "0"], ["1", "1"], ["2", "2"], ["2", "3"]], [["0", "1"], ["0", "2"], ["1", "2"], ["1", "3"], ["3", "0"], ["3", "3"]], [["0", "2"], ["0", "3"], ["2", "0"], ["2", "2"], ["3", "0"], ["3", "1"]], [["0", "2"], ["1", "0"], ["1", "3"], ["2", "1"], ["2", "3"], ["3", "1"]]], "28": [[["0", "1"], ["1", "3"], ["2", "0"], ["2", "3"], ["3", "0"], ["3", "1"]], [["0", "0"], ["1", "1"], ["1", "2"], ["2", "0"], ["3", "2"], ["3", "3"]], [["0", "1"], ["1", "3"], ["2", "0"], ["2", "1"], ["3", "0"], ["3", "3"]], [["0", "0"], ["1", "1"], ["1", "2"], ["2", "1"], ["2", "3"], ["3", "0"]], [["0", "0"], ["0", "1"], ["1", "3"], ["2", "0"], ["2", "2"], ["3", "3"]], [["0", "1"], ["1", "2"], ["1", "3"], ["2", "2"], ["3", "1"], ["3", "3"]], [["0", "1"], ["0", "3"], ["1", "1"], ["1", "2"], ["3", "0"], ["3", "2"]], [["0", "1"], ["1", "0"], ["2", "2"], ["2", "3"], ["3", "0"], ["3", "1"]], [["0", "3"], ["1", "3"], ["2", "0"], ["2", "2"], ["3", "1"], ["3", "2"]], [["0", "0"], ["0", "3"], ["1", "0"], ["2", "2"], ["3", "2"], ["3", "3"]], [["0", "2"], ["0", "3"], ["2", "0"], ["2", "2"], ["3", "1"], ["3", "3"]], [["0", "0"], ["0", "3"], ["2", "0"], ["2", "2"], ["3", "0"], ["3", "1"]], [["0", "1"], ["1", "0"], ["1", "2"], ["2", "0"], ["2", "3"], ["3", "2"]], [["0", "3"], ["1", "0"], ["2", "2"], ["2", "3"], ["3", "0"], ["3", "2"]], [["0", "1"], ["0", "2"], ["1", "2"], ["1", "3"], ["3", "0"], ["3", "3"]], [["0", "0"], ["0", "3"], ["1", "1"], ["1", "3"], ["3", "2"], ["3", "3"]]], "29": [[["0", "0"], ["0", "3"], ["1", "0"], ["1", "2"], ["2", "1"], ["2", "2"]], [["1", "0"], ["1", "1"], ["2", "1"], ["2", "3"], ["3", "0"], ["3", "2"]], [["0", "2"], ["1", "0"], ["1", "1"], ["2", "2"], ["3", "0"], ["3", "3"]], [["0", "2"], ["0", "3"], ["1", "3"], ["2", "0"], ["2", "1"], ["3", "1"]], [["0", "3"], ["1", "0"], ["1", "1"], ["2", "0"], ["2", "3"], ["3", "1"]], [["0", "1"], ["0", "2"], ["1", "0"], ["1", "3"], ["3", "1"], ["3", "3"]], [["0", "0"], ["1", "0"], ["2", "2"], ["2", "3"], ["3", "1"], ["3", "3"]], [["0", "1"], ["0", "3"], ["1", "1"], ["1", "2"], ["2", "0"], ["2", "2"]], [["0", "2"], ["0", "3"], ["1", "2"], ["2", "1"], ["2", "3"], ["3", "1"]], [["0", "2"], ["1", "3"], ["2", "2"], ["2", "3"], ["3", "0"], ["3", "1"]], [["0", "1"], ["0", "2"], ["1", "0"], ["2", "0"], ["2", "1"], ["3", "2"]], [["0", "1"], ["0", "2"], ["2", "2"], ["2", "3"], ["3", "0"], ["3", "2"]], [["0", "2"], ["0", "3"], ["1", "0"], ["1", "1"], ["2", "2"], ["3", "3"]], [["0", "0"], ["1", "1"], ["2", "3"], ["3", "0"], ["3", "1"], ["3", "3"]], [["0", "0"], ["0", "2"], ["2", "1"], ["2", "2"], ["3", "2"], ["3", "3"]], [["0", "2"], ["0", "3"], ["1", "0"], ["1", "3"], ["2", "1"], ["3", "1"]]]} -------------------------------------------------------------------------------- /submissions/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/submissions/readme.txt -------------------------------------------------------------------------------- /submissions/writeup_Nagayoshi.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Main Idea\n", 8 | "First of all, I started to consider an algorithm that can distinguish unsolvable inputs from solvable ones. As many other participants had noticed, this can be done simply by solving the Maximum Matching Problem on a bipartile graph. Here I give a simple proof:\n", 9 | "## Proof\n", 10 | "* * *\n", 11 | "Let $G = \\{V=R∪C,E\\}$ be a bipartile graph where $ R=\\{R_1,R_2,R_3,R_4\\}$,$ C=\\{C_1,C_2,C_3,C_4\\}$, and $E=\\{\\{R_n,C_m\\}|\\{n,m\\}$ is in the input$\\} $. Each Vertex represents either row or column of the board. It is easy to see that selecting three rows or columns to shoot lasor beam is equivalent to selecting three vertexes out of $V$, and whether all asteroids can be destroyed or not corresponds to whether the selected vertexes compose a Vertex cover of the graph. Therefore, if the board is solvable with $k$ laser beams, then the size of the Minimum Vertex cover is equal to $k$, and vice versa. Consequently, if a board is unsolvable, then its graph has no Vertex cover whose size is three or less, and must have a perfect matching. The converse also holds.\n", 12 | "* * *\n", 13 | "With this proof, there are several ways to construct the oracle part. One approach is to regard the board as (reduced) adjacency matrix. In this case, a perfect matching on a bipartile graph can be depicted as permutation matrix, thus it is possible to solve the problem by checking whether the adjacency matrix contains any permutation matrix. For expample, if the board contains four asteroids on (1,2), (2,4), (3,1), and (4,3), the board is unsolvable since they make up a permutation matrix.\n", 14 | "\n", 15 | "Another possible solution is to check whether the parmanent of the adjacency matrix is 0 or not.(Note: permanent is defined as is written here https://en.wikipedia.org/wiki/Permanent_(mathematics)) Mathematically, this approach is completely equivalent to the former one.\n", 16 | "\n", 17 | "My solution is based on the latter idea, and by encoding the board directly into each component, I reduced the cost of board preparation. In addition to that, I divided the calculation into 2 parts, since if not it would require at least 24 qubits alone (and there would be no room for ancilla)." 18 | ] 19 | }, 20 | { 21 | "cell_type": "code", 22 | "execution_count": 1, 23 | "metadata": {}, 24 | "outputs": [ 25 | { 26 | "name": "stderr", 27 | "output_type": "stream", 28 | "text": [ 29 | "/opt/conda/lib/python3.7/site-packages/qiskit/providers/ibmq/ibmqfactory.py:192: UserWarning: Timestamps in IBMQ backend properties, jobs, and job results are all now in local time instead of UTC.\n", 30 | " warnings.warn('Timestamps in IBMQ backend properties, jobs, and job results '\n" 31 | ] 32 | }, 33 | { 34 | "data": { 35 | "image/png": "iVBORw0KGgoAAAANSUhEUgAAAc0AAAFLCAYAAAC0rNfYAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/Il7ecAAAACXBIWXMAAAsTAAALEwEAmpwYAAA7QUlEQVR4nO3de3wU5d3//9dFwtGAcpBTOIaTEORkFGgRsGq9iy1WrXi2rVZttaLy866tB0S/Vm3trdhaa6XentqCoFYUKzdKVUQhGKiUQ4sggZIoBMEDFAgkfH5/XJ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pkNiLJwIiIimSTMmebzQHnM41qTpoiIyOHsoEnTzO6MeTwpraURERHJYIkOo/c359wxNcxv4Zz7W2SlEhERyUCJDm4wGmhUw/wmwMkpl0ZERCSDhWo965yLHQVogHNua8zzLOAMoDTKgomIiGSasF1OivANgAyYU8PyncB1URVKREQkE4VNmt3xw+atBU4CNscs2w2UmVllxGUTERHJKKGSppmtDx4mfNNqERGRw0WYwQ3OAV42sz3B41qZ2QuRlUxERCTDhDlzfA5oGfO4tmlGmDd0zl3jnCt2zu1yzi12ztXa6tY5N8o5965zbotzbqdz7l/OuZtqWO9c59xK51x58PfsMGURERFJxEGTpplVD8oePK5tyjpYLOfc+cBD+LukDAbeBV51znWp5SXbgV8DI4F+wN3Anc65a2JiDgeeBf4EDAr+znDODT1YeURERBJR19coJwBPmtkUM/unmV0HfAz8qKaVzWyxmU0zsxVmVmxmfwT+j337hN4AvGFmPw9i/hx4M5gvIiISmbDXNEM50DVN51wj4AT8jaxjzQG+Eia+c25wsO6kmNnDgd/Erfp/wI/DxBQREQkrTOvZ50LGMvxAB7VpEyzfFDd/E3DagQI750qAY/HlvdPMHo1Z3L6WmO1riXUVcBVAx44defPNNwHIy8ujefPmLF26FIDWrVuTn5/PvHnzAMjOzmbEiBEsWbKEL774AoCCggI2bdrEhg0bAOjVqxeNGzdm+fLlALRt25bevXszf/58ABo3bszw4cMpKipi+/btAAwdOpSSkhJKS/3YEH369CErK4uVK1f6f659e7p3786CBQsAaNq0KUOHDqWwsJCdO3cCMHz4cIqLi9m4cSMA/fr1o7KyklWrVgGQm5tLp06dKCwsBCAnJ4eCggIWLFhAebkfi3/EiBF88MEHlJX526P279+f8vJyVq9eDUDnzp1p164dRUVFALRo0YIhQ4Ywf/58KioqABg5ciQrVqxgy5YtAAwcOJBt27axdu1aALp160arVq1YsmQJAC1btmTgwIG89dZbmBnOOUaNGsXSpUv59NNPARgyZAhbt25l3bp1dfQ5ja7pa1OjsrIyfU6H7HPS70mfU/o+pwNxZnVz0xLnX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REQlLSFBERCUlJU0REJCQlTRERkZCUNEUiNHv2bPr06UPPnj2577779lteXl7O+eefT8+ePRk6dCjr1q3bZ/m///1vcnJy+NWvflU97/LLL6dt27b0798/3cWXOqDvSP2mpCkSkcrKSq699lpeffVVVq5cydSpU1m5cuU+6zz++OO0bNmSNWvWcOONN3LzzTfvs3zChAl84xvf2Gfe9773PWbPnp22cie7E1+0aBGDBg1i0KBBDBw4kL/85S/Vr3nooYfo378/+fn5TJ48OW1lr2/q63dEvqSkGVI6diwPPvgg+fn59O/fnwsvvJBdu3bV1b8Tiai3yapVq6rnDxo0iBYtWtSrHe6iRYvo2bMneXl5NGrUiAsuuICZM2fus87MmTP57ne/C8B3vvMd5s6di5kB8OKLL9K9e3fy8/P3ec3IkSNp1apVWsqcyk68f//+FBUV8f777zN79myuvvpqKioqWL58OVOmTGHRokX88pe/5NZbb6Vr16763ZD+78i2bdu0n0o3MztipxNOOMHCqKiosLy8PPvwww+tvLzcBgwYYCtWrNhnnd/+9rd29dVXm5nZ1KlTbdy4cWZm9p///Mf27NljZmYfffSRHXvssbZnzx4rKSmxbt262Y4dO8zM7LzzzrMnnngiVHkyQTq2SXz8du3a2bp16+rgv/nSDx4MP8WbMWOGXXHFFdXPn376abv22mv3WSc/P982bNhQ/TwvL882b95s27Zts2HDhtm2bdvsjjvusPvvv3+f1z355JPWqFEj69Gjh9177737vfeuXbts3Lhx1qNHDzvppJOsuLjYzMwKCwtt4MCBNnDgQBswYIC98MIL1a/p2rWr5eXlWU5OjlX9Fu655x6755579on99a9/3d59910zM9uzZ4+1bt3a9u7du886a9eutbZt29qePXts+vTpdvnll1d/R2644Qb7+c9/Xq9+N6+++qr17t078u3duXNna9WqVfX2jvI7smbNGmvYsKH2UxEAiqyWvKEzzRBSOTps1qwZ2dnZAOzatQvnXPVrKioq2LlzJ6+88gp//etfueWWWyI7OgR/FtGjRw9ycnIiPfIEWLBgAZs3b2b8+PGRbpMqc+fOpUePHnTt2nW/ZYejSZMmceONN5KTk7PfssrKSiZOnEjXrl0jOxuscuutt3L++edTVFQEQKdOnSgtLd0ndmlpKZ07dwYgOzubo48+mi1btgBQWFhIfn4+xx9/PI8++ijZ2dn079+ft99+m9dee43u3buzcOFCPv7443rzu9m9ezdnnXUWubm5kW/vSZMmcfbZZ1dv70Qc6DsCsHTpUho1apS2/VRFRQU7duygY8eOCZf9cKKkGULsTgOi2bHk5uZy00030blzZ8aOHcupp57KunXrIv2BPvjgg5SVlXHSSSdF/uOfMmUKxx57bKTbJNa0adO48MILD/i5ZJrc3Fw2bNhQ/bykpITc3Nxa16moqODzzz+ndevWFBYW8pOf/IRu3boxefJk7rnnHh5++GHA7+S7du1Ko0aN0nKAkoqhQ4eyYsUK3nvvPe6991527dpF3759ufnmm7nmmmtYvnw5gwYNIisrq978bm666SZatWpFs2bNIt/eHTp0SMt3BGDjxo00bNiw+nmU27tLly506NCBo48+mq9//escyZQ060BNO5ZPP/2UmTNnMmPGDE499VScc0yfPj2yH2hJSQnTpk3juOOOi/zHX1JSwpIlS+jTp0+k26TK7t27ee6555g8eXKkZ8gHuwabqhNPPJHVq1dTXFzM7t27mTZtGmPHjt1nnbFjx/LUU08B8Nxzz/G1r30N5xxvv/0269atY926ddxwww3ccsst/PjHPwb8jq5Dhw7VMaI6QHHO8Ytf/ILp06fz2GOPAYntxGP17duXnJwcli9fDsAVV1zBL3/5S775zW/SsmVLevfunfD2PFS/mzfeeIPBgwdXz4tye99yyy28+eab3HPPPZF+R6JwoO1dXFzME088wcyZM2nXrl1Cv8nXXnuNE044geOPP54TTjiBv/3tb9WvefbZZxkwYAD5+fn7NXjKVEqaIaRyBhErdsfy+uuv0717d3bs2EGXLl0455xzePfddyP7gd5www2cd955tG3btjpOlLEnTJjA5s2bI90mVWbNmkVFRQVz5syJ7Aw5TIOXVGVnZ/Pwww9zxhln0LdvX8aNG0d+fj4TJ07kpZdeAnwy2bJlCz179uSBBx4IlbwnT57Myy+/zKpVq+jUqRNvvfVWQuWq7QBl/vz5rFixgpYtW/Lggw8yd+7chHbixcXF1Wdo69ev51//+hfdunUDoKysjNzcXFavXs0LL7zARRddVG9+N5dccklKZ+QH2t5///vfeeKJJ7jzzjvp3r17ZN+RCy+8kNtvv53PP/+cTp068fjjj0e6vVu1asX111/PpEmT+Pa3v53Qb7JNmza8/PLLLFu2jKeeeopLL70UgC1btvDf//3fzJ07lxUrVrBx40bmzp2bxBavW0qaIaRyBlHbjqVLly4sXLiQ8vJyzIy5c+fSt2/fhMtW0w901qxZtG3blh49eqT0fx8o9qWXXkppaSk7duyIbJtUeeSRR8jLy4v02kyY69JRGDNmDB988AEffvght956KwB33XVX9bZp0qQJM2bMYM2aNSxatIi8vLz9YkyaNImbbrqp+vn999/PySefzJ49eygpKaFHjx6RHKDk5uaSnZ3N7373O8rKyhg3blxCO/H58+czcOBABg0axNlnn80jjzxCmzZtADj33HO5/PLLWbhwIbfddhvNmjWrN7+bkSNHUlZWVr1uVAeEVTEuuugifvazn3HjjTdG9h2ZOnUqmzZtolu3brz99ttceumlkW7vefPm0bNnT5YtW0b//v0T+k0OHjy4+jpofn4+O3fupLy8nLVr19KrVy+OPfZYZs+ezZw5czjnnHMiO4sdPXo0ffr0qa55iv1MU1JbC6EjYQrbetbM7JVXXrFevXpZXl6e3X333WZmdvvtt9vMmTPNzGznzp32ne98x3r06GEnnniiffjhh2bmW8f169fPBg4caIMHD7a//OUv1TEnTpxoXbp0saOOOsouueQS27VrV9KtF83MTjnlFHvvvffspz/9qeXm5lr79u2tUaNG1rRpU7v44osjjd21a1c75phjzDlnOTk5kW2T7du3W05Ojl166aXV8xJpYWhmtnDhQuvXr58dddRR1a0Xw7RsNUut9Wy67Nmzx7p3725r166tbhW5fPnyfdZ5+OGH92kVed5555mZb9Va1Spy3bp11qFDB9u8ebNt377dvvjiCzPz23z48OH26quvRl72+vi76dKli2VlZVnjxo3tggsu0PaeONE6duxoxxxzTPX2TvQ3WWXGjBl26qmnmpnZ1q1bLTc319asWWN5eXl2xhln2JgxYxJ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fYUU2H5E3r84Rvdv5+sNP6Hr5aLCdY1gx4Dj8MmGIrdr2JjW8ZegtwX9z8fGAy/lrpJ/hGR48rtmLXp9hRTofkTev7hL/w/yy+legn+AYZ/4u//2IhCVbTKLZiZ0Js/K3mjgseNyLu+hy+4cVeYJBiK3Z9ix3VpNazKQia/p+J79C/Cz8ayAxLctBmxVbsTIodxG+A33FVOueuxI++0kyxFftwiJ1UeZQ0o5Ho3RgUW7HrU+wg/gT8gNn3K7ZiH26xQ5dBSVNEwghu1VSZjsSs2Ip9qGOHLoOSpoiISDgNDnUBRERE6gslTRERkZCUNEVEREJS0hQREQlJSVNERCQkJU0REZGQ/n/gdciP5MN5OwAAAABJRU5ErkJggg==\n", 36 | "text/plain": [ 37 | "
" 38 | ] 39 | }, 40 | "execution_count": 1, 41 | "metadata": {}, 42 | "output_type": "execute_result" 43 | } 44 | ], 45 | "source": [ 46 | "#initialization\n", 47 | "import matplotlib.pyplot as plt\n", 48 | "%matplotlib inline\n", 49 | "import numpy as np\n", 50 | "\n", 51 | "# importing Qiskit\n", 52 | "from qiskit import IBMQ, BasicAer, Aer, QuantumCircuit, ClassicalRegister, QuantumRegister, execute\n", 53 | "from qiskit.providers.ibmq import least_busy\n", 54 | "from qiskit.visualization import plot_bloch_multivector\n", 55 | "from qiskit.tools.visualization import plot_histogram\n", 56 | "\n", 57 | "provider = IBMQ.load_account()\n", 58 | "provider.get_backend('ibmq_qasm_simulator')\n", 59 | "\n", 60 | "problem_set = \\\n", 61 | " [[['0', '2'], ['1', '0'], ['1', '2'], ['1', '3'], ['2', '0'], ['3', '3']],\n", 62 | " [['0', '0'], ['0', '1'], ['1', '2'], ['2', '2'], ['3', '0'], ['3', '3']],\n", 63 | " [['0', '0'], ['1', '1'], ['1', '3'], ['2', '0'], ['3', '2'], ['3', '3']],\n", 64 | " [['0', '0'], ['0', '1'], ['1', '1'], ['1', '3'], ['3', '2'], ['3', '3']],\n", 65 | " [['0', '2'], ['1', '0'], ['1', '3'], ['2', '0'], ['3', '2'], ['3', '3']],\n", 66 | " [['1', '1'], ['1', '2'], ['2', '0'], ['2', '1'], ['3', '1'], ['3', '3']],\n", 67 | " [['0', '2'], ['0', '3'], ['1', '2'], ['2', '0'], ['2', '1'], ['3', '3']],\n", 68 | " [['0', '0'], ['0', '3'], ['1', '2'], ['2', '2'], ['2', '3'], ['3', '0']],\n", 69 | " [['0', '3'], ['1', '1'], ['1', '2'], ['2', '0'], ['2', '1'], ['3', '3']],\n", 70 | " [['0', '0'], ['0', '1'], ['1', '3'], ['2', '1'], ['2', '3'], ['3', '0']],\n", 71 | " [['0', '1'], ['0', '3'], ['1', '2'], ['1', '3'], ['2', '0'], ['3', '2']],\n", 72 | " [['0', '0'], ['1', '3'], ['2', '0'], ['2', '1'], ['2', '3'], ['3', '1']],\n", 73 | " [['0', '1'], ['0', '2'], ['1', '0'], ['1', '2'], ['2', '2'], ['2', '3']],\n", 74 | " [['0', '3'], ['1', '0'], ['1', '3'], ['2', '1'], ['2', '2'], ['3', '0']],\n", 75 | " [['0', '2'], ['0', '3'], ['1', '2'], ['2', '3'], ['3', '0'], ['3', '1']],\n", 76 | " [['0', '1'], ['1', '0'], ['1', '2'], ['2', '2'], ['3', '0'], ['3', '1']]]\n", 77 | "\n", 78 | "import itertools\n", 79 | "\n", 80 | "def week3_ans_func(problem_set):\n", 81 | " data = [[[int([str(i),str(j)] in k) for j in range(4)] for i in range(4)] for k in problem_set]\n", 82 | " \n", 83 | " address = QuantumRegister(4)\n", 84 | " register = QuantumRegister(24)\n", 85 | " cr = ClassicalRegister(4)\n", 86 | " qc = QuantumCircuit(address, register,cr)\n", 87 | " # address preparation\n", 88 | " qc.h(address[:])\n", 89 | "\n", 90 | " for i in range(1):\n", 91 | " oracle(qc,address,register,data)\n", 92 | " diffusion(qc,address,register)\n", 93 | "\n", 94 | " qc.measure(address,cr)\n", 95 | " # Change the endian \n", 96 | " qc = qc.reverse_bits() \n", 97 | " \n", 98 | " return qc\n", 99 | "\n", 100 | "def oracle(circuit,address,register,data):\n", 101 | " for i in range(16):\n", 102 | " for n in range(4):\n", 103 | " if not i & (1< *A bipartite graph has a perfect matching (i.e., is only solveable by 4 beams) whenever the determinant of the **symbolic** matrix corresponding to the graph (i.e., the board matrix) is non-zero **as a polynomial**.*\n", 25 | "\n", 26 | "In general, the calculation of the determinant of a $4\\times 4$ matrix involves the calculation and addition/subtraction of 24 conjunctive terms (each consisting of 4 variables).Namely, \n", 27 | "$$\n", 28 | " +(afkp) -(aflo) -(agjp) +(agln) +(ahjo) -(ahkn)\\\\ \n", 29 | " -(bekp) +(belo) +(bgip) -(bglm) -(bhio) +(bhkm)\\\\ \n", 30 | " +(cejp) -(celn) -(cfip) +(cflm) +(chin) -(chjm)\\\\ \n", 31 | " -(dejo) +(dekn) +(dfio) -(dfkm) -(dgin) +(dgjm)\\\\\n", 32 | "$$\n", 33 | "given that the matrix has elements\n", 34 | "$$\n", 35 | " a b c d\\\\\n", 36 | " e f g h\\\\\n", 37 | " i j k l\\\\\n", 38 | " m n o p\\\\\n", 39 | "$$\n", 40 | "The statement from above is easyly misinterpreted as: \n", 41 | "> *A given board is only solveable with four beams $\\leftrightarrow \\det(Board) \\neq 0$, where $Board[i][j] = 1$ <-> there is an asteroid in position $(i,j)$.*\n", 42 | "\n", 43 | "However, there are instances of boards with a determinant equal to zero, which are still only solvable with four beams.\n", 44 | "The key point in the statement above is that the matrix has to be considered as a *symbolic* matrix (not as a binary matrix).\n", 45 | "Consequently, whenever at least one of the terms in the calculation of the determinant is not equal to the zero polynomial, there exists a maximal matching. \n", 46 | "In the challenge we only have binary board matrices and no way create a symbolic matrix in the quantum ciruit.\n", 47 | "Thus, just calculating the determinant is not enough. See also [this post on StackOverflow](https://math.stackexchange.com/questions/2228262/the-determinant-and-perfect-matching). \n", 48 | "However, there exists a quantity closely related to the determinant, that does the trick; namely the *permanent*.\n", 49 | "The permanent of a matrix is just the sum of all the individual terms that would normaly contribute to the determinant of the matrix (i.e., disregarding the minus).\n", 50 | "Now, it holds that\n", 51 | "> *A given board is only solveable with four beams $\\leftrightarrow perm(Board) \\gt 0$, where $Board[i][j] = 1$ <-> there is an asteroid in position $(i,j)$.*\n", 52 | "\n", 53 | "This gives us actionable advice for what to calculate. Moreover, some knowledge about the problem itself can be exploited to reduce the amount of computations necessary. \n", 54 | "It is apriori known, that the board is $4\\times 4$ and contains exactly six ones. \n", 55 | "One can show (the arguments are related to [Hadamard's maximum determinant problem](https://mathworld.wolfram.com/HadamardsMaximumDeterminantProblem.html)) that this implies that the permanent of the matrix is either $0$, $1$, or $2$.\n", 56 | "This means, that in case the board is not the board we are looking for, none of the 24 conditions trigger (which corresponds to the determinant of the matrix being the zero polynomial), while, in case of the target board, up to 2 conditions trigger.\n", 57 | "\n", 58 | "### Design of the Oracle\n", 59 | "The goal of the oracle part in Grover's algorithm is to mark the desired target state. This is typically done by flipping the phase of a flag qubit. \n", 60 | "In principle, my oracle just computes the permanent of the board matrix and adds a corresponding phase to a flag qubit whenever the permanent is non-zero. \n", 61 | "One general way of doing this would be to take two auxillary qubits as a counter, which is incremented whenever one of the 24 individual terms evaluates to $1$, and then, afterwards, check whether the count is non-zero.\n", 62 | "\n", 63 | "However, the theoretical considerations from above have shown, that only a maximum of two terms trigger during the permanent calculation. \n", 64 | "Consequently, the additions (i.e. the counting) in the general formula can be replaced by just adding a phase of $\\frac{3\\pi}{4}$ to the flag qubit whenever a condition triggers.\n", 65 | "In case only one condition triggers (which actually happens most of the time) a phase of $\\frac{3\\pi}{4}$ is applied, while a total phase of $\\frac{6\\pi}{4}\\equiv -\\frac{\\pi}{2}$ is applied in case two conditions trigger. \n", 66 | "On the positive side, this avoids all the counting, makes a lot of room for using the available qubits to their full extent and requires almost no uncomputation. \n", 67 | "On the negative side, the phase difference between the two cases also implies that the corresponding solutions are amplified to a different extent. \n", 68 | "For one iteration of Grover's algorithm, the achieved probabilities for the target state are $\\approx42\\%$ in case $perm(Board)=1$, and $\\approx27\\%$ in case $perm(Board)=2$, whereas non-target states have a probability of $\\approx 4-5\\%$.\n", 69 | "\n", 70 | "### Loading the Data\n", 71 | "\n", 72 | "The boards' data is loaded using a QRAM structure with 4 address qubits, 16 data qubits and a total of 3 ancillary qubits. The order of 'writes' is a 4-bit [Gray code](https://en.wikipedia.org/wiki/Gray_code) sequence starting from $1111$, i.e., \n", 73 | "$$\n", 74 | " 1111 \\rightarrow 1110 \\rightarrow 1010\\rightarrow 1011 \\rightarrow\n", 75 | " 1001\\rightarrow 1000\\rightarrow 0000\\rightarrow 0001\\rightarrow\n", 76 | " 0011\\rightarrow 0010\\rightarrow 0110\\rightarrow 0111\\rightarrow\n", 77 | " 0101\\rightarrow 0100\\rightarrow 1100\\rightarrow 1101\n", 78 | "$$\n", 79 | "This way, only one bit changes between subsequent writes, which minimizes the (un-)computations that is necessary between different addresses.\n", 80 | "\n", 81 | "### The Whole Circuit\n", 82 | "The complete circuit is then composed of\n", 83 | " - Initialization\n", 84 | " - QRAM\n", 85 | " - Oracle\n", 86 | " - QRAM$^{-1}$\n", 87 | " - Diffusion\n", 88 | "\n", 89 | "It uses 4 address qubits, 16 data qubits, a flag qubit and 7 ancillary qubits.\n", 90 | "\n", 91 | "### Optimizations\n", 92 | "The above considerations allow to reliably solve the problem at hand using Grover's algorithm. In order to reduce the cost of the resulting circuit, several optimizations have been applied. The following list aims to provide an overview:\n", 93 | "- All (multi-controlled) Toffoli gates uses the maximum of available ancillaries (which involved writing these decompositions by hand) in order to store temporary results and save gates.\n", 94 | "- All Toffoli gates which are uncomputed later in the circuit can be realized using relative-phase Toffoli gates (*rccx*). This includes all of the QRAM and large parts of the oracle and the diffusion.\n", 95 | "- Observant ordering of computations gives rise to many situations where whole Toffoli gates can be cancelled.\n", 96 | "- Two Toffoli gates acting on the same target line and sharing a control can be implemented using fewer CNOT gates than two individual Toffoli gates (this also holds for relative-phase Toffoli gates)\n", 97 | "- Implementing a controlled-phase gate is more efficient than implementing a Toffoli gate\n", 98 | "- Careful inspection of the circuit allows to cancel many consecutive single-qubit gates throughout the whole circuit.\n", 99 | "- IBM devices support arbitrary single-qubit gates. Thus, every sequence of consecutive single-qubit gates may be fused into a single gate.\n", 100 | "\n", 101 | "### Final Cost\n", 102 | "Overall, my design resulted in a total cost of **6552** using *612 CX* and *432 U3 gates*." 103 | ] 104 | }, 105 | { 106 | "cell_type": "code", 107 | "execution_count": 1, 108 | "metadata": {}, 109 | "outputs": [], 110 | "source": [ 111 | "problem_set = \\\n", 112 | " [[['0', '2'], ['1', '0'], ['1', '2'], ['1', '3'], ['2', '0'], ['3', '3']],\n", 113 | " [['0', '0'], ['0', '1'], ['1', '2'], ['2', '2'], ['3', '0'], ['3', '3']],\n", 114 | " [['0', '0'], ['1', '1'], ['1', '3'], ['2', '0'], ['3', '2'], ['3', '3']],\n", 115 | " [['0', '0'], ['0', '1'], ['1', '1'], ['1', '3'], ['3', '2'], ['3', '3']],\n", 116 | " [['0', '2'], ['1', '0'], ['1', '3'], ['2', '0'], ['3', '2'], ['3', '3']],\n", 117 | " [['1', '1'], ['1', '2'], ['2', '0'], ['2', '1'], ['3', '1'], ['3', '3']],\n", 118 | " [['0', '2'], ['0', '3'], ['1', '2'], ['2', '0'], ['2', '1'], ['3', '3']],\n", 119 | " [['0', '0'], ['0', '3'], ['1', '2'], ['2', '2'], ['2', '3'], ['3', '0']],\n", 120 | " [['0', '3'], ['1', '1'], ['1', '2'], ['2', '0'], ['2', '1'], ['3', '3']],\n", 121 | " [['0', '0'], ['0', '1'], ['1', '3'], ['2', '1'], ['2', '3'], ['3', '0']],\n", 122 | " [['0', '1'], ['0', '3'], ['1', '2'], ['1', '3'], ['2', '0'], ['3', '2']],\n", 123 | " [['0', '0'], ['1', '3'], ['2', '0'], ['2', '1'], ['2', '3'], ['3', '1']],\n", 124 | " [['0', '1'], ['0', '2'], ['1', '0'], ['1', '2'], ['2', '2'], ['2', '3']],\n", 125 | " [['0', '3'], ['1', '0'], ['1', '3'], ['2', '1'], ['2', '2'], ['3', '0']],\n", 126 | " [['0', '2'], ['0', '3'], ['1', '2'], ['2', '3'], ['3', '0'], ['3', '1']],\n", 127 | " [['0', '1'], ['1', '0'], ['1', '2'], ['2', '2'], ['3', '0'], ['3', '1']]]" 128 | ] 129 | }, 130 | { 131 | "cell_type": "code", 132 | "execution_count": 2, 133 | "metadata": {}, 134 | "outputs": [], 135 | "source": [ 136 | "from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister\n", 137 | "from qiskit.qasm import pi\n", 138 | "\n", 139 | "\"\"\" \n", 140 | " Given a pair ['i', 'j'] returns the corresponding (1D) index on the board\n", 141 | "\"\"\"\n", 142 | "def idx(meteor):\n", 143 | " return int(meteor[0]) * 4 + int(meteor[1])\n", 144 | "\n", 145 | "\n", 146 | "\"\"\" \n", 147 | " Optimized version of the RCCX gate of Qiskit \n", 148 | " fused single qubit gates together and additionally allows to exclude the first or last single qubit gate \n", 149 | "\"\"\"\n", 150 | "def rccx_opt(side = 'both'):\n", 151 | " a = QuantumRegister(1)\n", 152 | " b = QuantumRegister(1)\n", 153 | " target = QuantumRegister(1)\n", 154 | " qc = QuantumCircuit(a, b, target)\n", 155 | "\n", 156 | " if side in ['both', 'left']:\n", 157 | " qc.u(pi/2, pi/4, pi, target) # -H-T-\n", 158 | " qc.cx(b, target)\n", 159 | " qc.tdg(target)\n", 160 | " qc.cx(a, target)\n", 161 | " qc.t(target)\n", 162 | " qc.cx(b, target)\n", 163 | " if side in ['both', 'right']:\n", 164 | " qc.u(pi/2, 0, 3*pi/4, target) # -Tdg-H-\n", 165 | " return qc.to_gate(label='rccx')\n", 166 | "\n", 167 | "\n", 168 | "\n", 169 | "\"\"\" \n", 170 | " Optimized version of the CCX gate of Qiskit \n", 171 | " fused single qubit gates together and additionally allows to exclude the first or last single qubit gate \n", 172 | "\"\"\"\n", 173 | "def ccx_opt(side='both'):\n", 174 | " a = QuantumRegister(1)\n", 175 | " b = QuantumRegister(1)\n", 176 | " target = QuantumRegister(1)\n", 177 | " qc = QuantumCircuit(a, b, target)\n", 178 | " if side in ['both', 'left']:\n", 179 | " qc.h(target)\n", 180 | " qc.cx(b, target)\n", 181 | " qc.tdg(target)\n", 182 | " qc.cx(a, target)\n", 183 | " qc.t(target)\n", 184 | " qc.cx(b, target)\n", 185 | " qc.tdg(target)\n", 186 | " qc.cx(a, target)\n", 187 | " qc.t(b)\n", 188 | " qc.cx(a, b)\n", 189 | " qc.t(a)\n", 190 | " qc.tdg(b)\n", 191 | " qc.cx(a, b)\n", 192 | " if side in ['both', 'right']:\n", 193 | " qc.u(pi/2, 0, 5*pi/4, target) # -T-H-\n", 194 | " return qc.to_gate(label='ccx')\n", 195 | "\n", 196 | "\n", 197 | "\"\"\"\n", 198 | " optimized version of two Toffoli gates targeted at the same qubit and sharing a control\n", 199 | " 10 CNOTs + 10 single qubit gates --> 110 cost\n", 200 | "\"\"\" \n", 201 | "def double_ccx_opt(side='both'):\n", 202 | " a = QuantumRegister(1)\n", 203 | " b = QuantumRegister(1) # shared control\n", 204 | " c = QuantumRegister(1)\n", 205 | " target = QuantumRegister(1)\n", 206 | " qc = QuantumCircuit(a, b, c, target)\n", 207 | "\n", 208 | " if side in ['both', 'left']:\n", 209 | " qc.u(pi/2, -pi/4, pi, target)\n", 210 | " qc.cx(a, b)\n", 211 | " qc.tdg(a)\n", 212 | " qc.t(b)\n", 213 | " qc.cx(a, b)\n", 214 | " qc.cx(a, target)\n", 215 | " qc.t(target)\n", 216 | " qc.cx(b, target)\n", 217 | " qc.tdg(target)\n", 218 | " qc.cx(a, target)\n", 219 | " qc.cx(c, target)\n", 220 | " qc.t(target)\n", 221 | " qc.cx(b, target)\n", 222 | " qc.tdg(target)\n", 223 | " qc.cx(c, target)\n", 224 | " qc.cx(c, b)\n", 225 | " qc.tdg(b)\n", 226 | " qc.t(c)\n", 227 | " qc.cx(c, b)\n", 228 | " if side in ['both', 'right']:\n", 229 | " qc.u(pi/2, 0, 5*pi/4, target)\n", 230 | "\n", 231 | " return qc.to_gate(label='2ccx')\n", 232 | "\n", 233 | "\n", 234 | "\"\"\"\n", 235 | " optimized version of two double-controlled (3*pi/4)-phase-gates targeted at the same qubit and sharing a control\n", 236 | " 8 CNOTs + 8 single qubit gates --> 88 cost\n", 237 | "\"\"\" \n", 238 | "def double_ccp_opt():\n", 239 | " a = QuantumRegister(1)\n", 240 | " b = QuantumRegister(1)\n", 241 | " c = QuantumRegister(1)\n", 242 | " target = QuantumRegister(1)\n", 243 | " qc = QuantumCircuit(a, b, c, target)\n", 244 | " qc.cx(a, target)\n", 245 | " qc.p(-3*pi/8, target)\n", 246 | " qc.cx(b, target)\n", 247 | " qc.p(3*pi/8, target)\n", 248 | " qc.cx(a, target)\n", 249 | " qc.p(-3*pi/8, target)\n", 250 | " qc.cx(b, target)\n", 251 | " qc.p(3*pi/8, target)\n", 252 | " qc.cx(b, target)\n", 253 | " qc.p(-3*pi/8, target)\n", 254 | " qc.cx(c, target)\n", 255 | " qc.p(3*pi/8, target)\n", 256 | " qc.cx(b, target)\n", 257 | " qc.p(-3*pi/8, target)\n", 258 | " qc.cx(c, target)\n", 259 | " qc.p(3*pi/8, target)\n", 260 | " return qc.to_gate(label='2ccp')\n", 261 | "\n", 262 | "\n", 263 | "\"\"\"\n", 264 | " Optimized version of two relative-phase Toffoli gates targeted at the same qubit and sharing a control\n", 265 | " 4 CNOTs + 4 single qubit gates --> 44 cost\n", 266 | "\"\"\"\n", 267 | "def double_rccx_opt(side ='both'):\n", 268 | " a = QuantumRegister(1)\n", 269 | " b = QuantumRegister(1) # shared control\n", 270 | " c = QuantumRegister(1)\n", 271 | " target = QuantumRegister(1)\n", 272 | " qc = QuantumCircuit(a, b, c, target)\n", 273 | "\n", 274 | " if side in ['both', 'left']:\n", 275 | " qc.u(pi/2, pi/4, pi, target)\n", 276 | " qc.cx(b, target)\n", 277 | " qc.tdg(target)\n", 278 | " qc.cx(a, target)\n", 279 | " qc.cx(c, target)\n", 280 | " qc.t(target)\n", 281 | " qc.cx(b, target)\n", 282 | " if side in ['both', 'right']:\n", 283 | " qc.u(pi/2, 0, 3*pi/4, target)\n", 284 | "\n", 285 | " return qc.to_gate(label='2rccx')\n", 286 | "\n", 287 | "\n", 288 | "\"\"\"\n", 289 | " QRAM implementation using 4 address (qu)bits, 16 data (qu)bits and a total of 3 ancillary qubits.\n", 290 | " The order of 'writes' is a 4-bit Gray code sequence starting from '1111'. \n", 291 | " This minimizes the (un-)computations between different addresses.\n", 292 | "\"\"\"\n", 293 | "def qram(problem_set):\n", 294 | " address = QuantumRegister(4) # address of qram\n", 295 | " data = QuantumRegister(16) # data of qram\n", 296 | " anc = QuantumRegister(3) # ancillary\n", 297 | " qc = QuantumCircuit(address, data, anc)\n", 298 | "\n", 299 | " graycode = ['1111', '1110', '1010', '1011',\n", 300 | " '1001', '1000', '0000', '0001',\n", 301 | " '0011', '0010', '0110', '0111',\n", 302 | " '0101', '0100', '1100', '1101']\n", 303 | " graycodeidx = [0, 2, 0, 1,\n", 304 | " 0, 3, 0, 1,\n", 305 | " 0, 2, 0, 1,\n", 306 | " 0, 3, 0, 1]\n", 307 | " for i, code in enumerate(graycode):\n", 308 | " if i == 0:\n", 309 | " qc.append(rccx_opt('right'), [address[0], address[1], anc[0]])\n", 310 | " qc.append(rccx_opt(), [address[2], address[3], anc[1]])\n", 311 | " qc.append(rccx_opt(), anc[0:3])\n", 312 | " else:\n", 313 | " if graycodeidx[i-1] <= 1:\n", 314 | " qc.cx(anc[0], anc[2])\n", 315 | " qc.t(anc[2])\n", 316 | " qc.cx(anc[1], anc[2])\n", 317 | " qc.u(pi/2, 0, 3*pi/4, anc[2])\n", 318 | " else:\n", 319 | " qc.cx(anc[1], anc[2])\n", 320 | " qc.t(anc[2])\n", 321 | " qc.cx(anc[0], anc[2])\n", 322 | " qc.u(pi / 2, 0, 3 * pi / 4, anc[2])\n", 323 | "\n", 324 | " for meteor in problem_set[int(code, 2)]:\n", 325 | " qc.cx(anc[2], data[idx(meteor)])\n", 326 | "\n", 327 | " if i == 15:\n", 328 | " qc.append(rccx_opt('left'), anc[0:3])\n", 329 | " qc.append(rccx_opt('left'), [address[0], address[1], anc[0]])\n", 330 | " qc.append(rccx_opt('left'), [address[2], address[3], anc[1]])\n", 331 | " else:\n", 332 | " if graycodeidx[i] <= 1:\n", 333 | " qc.u(pi/2, pi/4, pi, anc[2])\n", 334 | " qc.cx(anc[1], anc[2])\n", 335 | " qc.tdg(anc[2])\n", 336 | " qc.cx(anc[0], anc[2])\n", 337 | " else:\n", 338 | " qc.u(pi / 2, pi / 4, pi, anc[2])\n", 339 | " qc.cx(anc[0], anc[2])\n", 340 | " qc.tdg(anc[2])\n", 341 | " qc.cx(anc[1], anc[2])\n", 342 | " if graycodeidx[i] == 0:\n", 343 | " qc.cx(address[1], anc[0])\n", 344 | " elif graycodeidx[i] == 1:\n", 345 | " qc.cx(address[0], anc[0])\n", 346 | " elif graycodeidx[i] == 2:\n", 347 | " qc.cx(address[3], anc[1])\n", 348 | " else:\n", 349 | " qc.cx(address[2], anc[1])\n", 350 | "\n", 351 | " if i != 15 and graycodeidx[i] != 0: # last x can be skipped\n", 352 | " qc.x(address[graycodeidx[i]])\n", 353 | "\n", 354 | " return qc.to_gate(label='QRAM')\n", 355 | "\n", 356 | "\n", 357 | "\"\"\"\n", 358 | " This oracle applies the permanent of the board matrix as a phase to the flag qubit.\n", 359 | "\"\"\"\n", 360 | "def oracle():\n", 361 | " data = QuantumRegister(16) # data for oracle\n", 362 | " anc = QuantumRegister(7) # ancillary\n", 363 | " flag = QuantumRegister(1) # flag register\n", 364 | " qc = QuantumCircuit(data, anc, flag)\n", 365 | "\n", 366 | " # compute\n", 367 | " qc.append(rccx_opt('right'), [data[0], data[5], anc[0]])\n", 368 | " qc.append(rccx_opt('right'), [data[11], data[14], anc[1]])\n", 369 | " qc.append(rccx_opt('right'), [data[2], data[4], anc[2]])\n", 370 | " qc.append(rccx_opt(), [data[11], data[13], anc[3]])\n", 371 | " qc.append(rccx_opt(), [data[10], data[15], anc[4]])\n", 372 | " qc.append(rccx_opt(), [data[1], data[4], anc[5]])\n", 373 | " qc.append(rccx_opt(), [data[9], data[15], anc[6]])\n", 374 | "\n", 375 | " # mark solution\n", 376 | " qc.append(double_ccp_opt(), [anc[1], anc[0], anc[4], flag])\n", 377 | " qc.append(double_ccp_opt(), [anc[1], anc[5], anc[4], flag])\n", 378 | " qc.append(double_ccp_opt(), [anc[3], anc[2], anc[6], flag])\n", 379 | " qc.append(rccx_opt('left'), [data[2], data[4], anc[2]])\n", 380 | " qc.append(rccx_opt('right'), [data[0], data[6], anc[2]])\n", 381 | " qc.append(double_ccp_opt(), [anc[3], anc[2], anc[6], flag])\n", 382 | "\n", 383 | " # uncompute\n", 384 | " qc.append(rccx_opt('left'), [data[10], data[15], anc[4]])\n", 385 | " qc.append(rccx_opt('left'), [data[0], data[6], anc[2]])\n", 386 | " qc.append(rccx_opt('left'), [data[11], data[14], anc[1]])\n", 387 | "\n", 388 | " # uncompute and compute\n", 389 | " qc.append(double_rccx_opt(), [data[5], data[0], data[7], anc[0]])\n", 390 | " qc.append(double_rccx_opt(), [data[13], data[11], data[12], anc[3]])\n", 391 | " qc.append(double_rccx_opt(), [data[1], data[4], data[3], anc[5]])\n", 392 | " qc.append(double_rccx_opt(), [data[9], data[15], data[8], anc[6]])\n", 393 | "\n", 394 | " # compute\n", 395 | " qc.append(rccx_opt('right'), [data[10], data[13], anc[1]])\n", 396 | " qc.append(rccx_opt('right'), [data[1], data[6], anc[2]])\n", 397 | " qc.append(rccx_opt('right'), [data[9], data[14], anc[4]])\n", 398 | "\n", 399 | " # mark solution\n", 400 | " qc.append(double_ccp_opt(), [anc[1], anc[0], anc[4], flag])\n", 401 | " qc.append(double_ccp_opt(), [anc[1], anc[5], anc[4], flag])\n", 402 | " qc.append(double_ccp_opt(), [anc[3], anc[2], anc[6], flag])\n", 403 | " qc.append(rccx_opt('left'), [data[1], data[6], anc[2]])\n", 404 | " qc.append(rccx_opt('right'), [data[2], data[5], anc[2]])\n", 405 | " qc.append(double_ccp_opt(), [anc[3], anc[2], anc[6], flag])\n", 406 | "\n", 407 | " # uncompute\n", 408 | " qc.append(rccx_opt('left'), [data[0], data[7], anc[0]])\n", 409 | " qc.append(rccx_opt('left'), [data[3], data[4], anc[5]])\n", 410 | "\n", 411 | " # uncompute and compute\n", 412 | " qc.append(double_rccx_opt(), [data[5], data[2], data[7], anc[2]])\n", 413 | " qc.append(double_rccx_opt(), [data[13], data[10], data[12], anc[1]])\n", 414 | " qc.append(double_rccx_opt(), [data[11], data[12], data[9], anc[3]])\n", 415 | " qc.append(double_rccx_opt(), [data[9], data[14], data[8], anc[4]])\n", 416 | " qc.append(double_rccx_opt(), [data[15], data[8], data[13], anc[6]])\n", 417 | "\n", 418 | " # compute\n", 419 | " qc.append(rccx_opt('right'), [data[1], data[7], anc[5]])\n", 420 | " qc.append(rccx_opt('right'), [data[3], data[5], anc[0]])\n", 421 | "\n", 422 | " # mark solution\n", 423 | " qc.append(double_ccp_opt(), [anc[1], anc[0], anc[4], flag])\n", 424 | " qc.append(double_ccp_opt(), [anc[1], anc[5], anc[4], flag])\n", 425 | " qc.append(double_ccp_opt(), [anc[3], anc[2], anc[6], flag])\n", 426 | " qc.append(rccx_opt('left'), [data[2], data[7], anc[2]])\n", 427 | " qc.append(rccx_opt('right'), [data[3], data[6], anc[2]])\n", 428 | " qc.append(double_ccp_opt(), [anc[3], anc[2], anc[6], flag])\n", 429 | "\n", 430 | " # uncompute\n", 431 | " qc.append(rccx_opt(), [data[3], data[6], anc[2]])\n", 432 | " qc.append(rccx_opt(), [data[8], data[13], anc[6]])\n", 433 | " qc.append(rccx_opt(), [data[1], data[7], anc[5]])\n", 434 | " qc.append(rccx_opt(), [data[8], data[14], anc[4]])\n", 435 | " qc.append(rccx_opt('left'), [data[9], data[12], anc[3]])\n", 436 | " qc.append(rccx_opt('left'), [data[10], data[12], anc[1]])\n", 437 | " qc.append(rccx_opt('left'), [data[3], data[5], anc[0]])\n", 438 | "\n", 439 | " return qc.to_gate(label='oracle')\n", 440 | "\n", 441 | "\n", 442 | "\"\"\"\n", 443 | " Standard diffusion operator optimized by fusing single quibt gates\n", 444 | "\"\"\"\n", 445 | "def diffusion():\n", 446 | " address = QuantumRegister(4) # data for oracle\n", 447 | " anc = QuantumRegister(1)\n", 448 | " qc = QuantumCircuit(address, anc)\n", 449 | "\n", 450 | " qc.u(pi/2, 0, 0, address[0:3]) # --H-X--\n", 451 | " qc.u(pi/2, 0, 0, address[3]) # Technically this is --H-X-H-- but the last H cancels with the first H in the Toffoli gate below\n", 452 | " qc.append(rccx_opt('right'), [address[0], address[1], anc[0]]) # it suffices to use right here because the single qubit gates on the ancillary cancel with the QRAM rccx's\n", 453 | " qc.append(ccx_opt('right'), [address[2], anc[0], address[3]]) # it suffices to use 'right' here because the Hadamard gate cancels\n", 454 | " qc.append(rccx_opt(), [address[0], address[1], anc[0]])\n", 455 | " qc.z(address[3]) # if only one iteration where to be applied this gate can be skipped since any diagonal gate at the end may be ignored\n", 456 | " qc.u(pi/2, pi, pi, address[0:3]) # --X-H--\n", 457 | "\n", 458 | " return qc.to_gate(label='diffusion')\n", 459 | "\n", 460 | "\n", 461 | "\"\"\"\n", 462 | " Complete circuit composed of\n", 463 | " - Initialization\n", 464 | " - QRAM\n", 465 | " - Oracle\n", 466 | " - QRAM\n", 467 | " - Diffusion\n", 468 | " The circuit uses 4 address qubits, 16 data qubits, a flag qubit and 7 ancillary qubits.\n", 469 | " Its total cost is 6552 using 612 CX and 432 U3 gates.\n", 470 | "\"\"\"\n", 471 | "def week3_ans_func(problem_set):\n", 472 | " address = QuantumRegister(4, 'address') # address of qram\n", 473 | " data = QuantumRegister(16, 'data') # data of qram\n", 474 | " anc = QuantumRegister(7, 'anc') # ancillary qubits\n", 475 | " flag = QuantumRegister(1, 'flag') # flag qubit\n", 476 | " cr = ClassicalRegister(4, 'classical')\n", 477 | " qc = QuantumCircuit(cr, address, data, anc, flag)\n", 478 | "\n", 479 | " # initialization\n", 480 | " qc.h(address[:])\n", 481 | " qc.x(flag) # flag starts in |1>\n", 482 | " niterations = 1\n", 483 | " for _ in range(niterations):\n", 484 | " qc.u(pi/2, pi/4, pi, anc[0]) # saves an additional gate later on in between QRAM^-1 and diffusion\n", 485 | " qc.append(qram(problem_set), address[:] + data[:] + anc[0:3])\n", 486 | " qc.append(oracle(), data[:]+anc[:]+flag[:])\n", 487 | " qc.append(qram(problem_set).inverse(), address[:] + data[:] + anc[0:3])\n", 488 | " qc.append(diffusion(), address[:]+anc[0:1])\n", 489 | "\n", 490 | " qc.measure(address, cr)\n", 491 | " qc = qc.reverse_bits()\n", 492 | "\n", 493 | " return qc\n" 494 | ] 495 | }, 496 | { 497 | "cell_type": "code", 498 | "execution_count": 3, 499 | "metadata": {}, 500 | "outputs": [ 501 | { 502 | "name": "stdout", 503 | "output_type": "stream", 504 | "text": [ 505 | "Running week3_ans_func...\n", 506 | "Computing cost...\n", 507 | "Starting experiments. Please wait...\n", 508 | "You may monitor the job (id: 5fcf617f9478000012931520) status and proceed to grading when it successfully completes.\n" 509 | ] 510 | }, 511 | { 512 | "data": { 513 | "text/plain": [ 514 | "{'0000': 36,\n", 515 | " '0001': 43,\n", 516 | " '0010': 45,\n", 517 | " '0011': 37,\n", 518 | " '0100': 46,\n", 519 | " '0101': 411,\n", 520 | " '0110': 32,\n", 521 | " '0111': 48,\n", 522 | " '1000': 44,\n", 523 | " '1001': 30,\n", 524 | " '1010': 41,\n", 525 | " '1011': 37,\n", 526 | " '1100': 34,\n", 527 | " '1101': 34,\n", 528 | " '1110': 43,\n", 529 | " '1111': 39}" 530 | ] 531 | }, 532 | "execution_count": 3, 533 | "metadata": {}, 534 | "output_type": "execute_result" 535 | } 536 | ], 537 | "source": [ 538 | "# Submission code\n", 539 | "from qc_grader.exercises.week3 import prepare_ex3, grade_ex3, submit_ex3, criteria\n", 540 | "\n", 541 | "# Execute your circuit with following prepare_ex3() function.\n", 542 | "# The prepare_ex3() function works like the execute() function with only QuantumCircuit as an argument.\n", 543 | "job = prepare_ex3(week3_ans_func)\n", 544 | "\n", 545 | "result = job.result()\n", 546 | "counts = result.get_counts()\n", 547 | "original_problem_set_counts = counts[0]\n", 548 | "\n", 549 | "original_problem_set_counts\n", 550 | "# The bit string with the highest number of observations is treated as the solution." 551 | ] 552 | }, 553 | { 554 | "cell_type": "code", 555 | "execution_count": 4, 556 | "metadata": {}, 557 | "outputs": [ 558 | { 559 | "name": "stdout", 560 | "output_type": "stream", 561 | "text": [ 562 | "Grading your answer. Please wait...\n", 563 | "\n", 564 | "Congratulations 🎉! Your answer is correct.\n", 565 | "Your score is 6552.\n", 566 | "The lower your score the better!\n", 567 | "Feel free to submit your answer.\n" 568 | ] 569 | } 570 | ], 571 | "source": [ 572 | "# Check your answer by executing following code.\n", 573 | "# The quantum cost of the QuantumCircuit is obtained as the score. The lower the cost, the better.\n", 574 | "grade_ex3(job)" 575 | ] 576 | }, 577 | { 578 | "cell_type": "code", 579 | "execution_count": null, 580 | "metadata": {}, 581 | "outputs": [], 582 | "source": [ 583 | "# Submit your results by executing following code. You can submit as many times as you like during the period. \n", 584 | "submit_ex3(job)" 585 | ] 586 | } 587 | ], 588 | "metadata": { 589 | "kernelspec": { 590 | "display_name": "Python 3", 591 | "language": "python", 592 | "name": "python3" 593 | }, 594 | "language_info": { 595 | "codemirror_mode": { 596 | "name": "ipython", 597 | "version": 3 598 | }, 599 | "file_extension": ".py", 600 | "mimetype": "text/x-python", 601 | "name": "python", 602 | "nbconvert_exporter": "python", 603 | "pygments_lexer": "ipython3", 604 | "version": "3.7.8" 605 | } 606 | }, 607 | "nbformat": 4, 608 | "nbformat_minor": 2 609 | } 610 | -------------------------------------------------------------------------------- /submissions/writeup_jarnicki.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/submissions/writeup_jarnicki.pdf -------------------------------------------------------------------------------- /submissions/writeup_joelms.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 2, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "from qiskit import *\n", 10 | "import numpy as np" 11 | ] 12 | }, 13 | { 14 | "cell_type": "markdown", 15 | "metadata": {}, 16 | "source": [ 17 | "# 1. Approach to the problem\n", 18 | "The main part of the ‘false asteroids’ problem is to find a way to identify some universal characteristic of all the boards that cannot be cleared with 3 laser shots. We need to first ask the question, what is the minimum number of asteroids that is required to make the board unsolvable? We know that boards with only 3 asteroids are clearable because we have 3 laser shots. Looking at boards with 4 asteroids we see that the diagonal board cannot be cleared with 3 laser shots (1 represents presence of an asteroid at that point):
\n", 19 | "1 0 0 0
\n", 20 | "0 1 0 0
\n", 21 | "0 0 1 0
\n", 22 | "0 0 0 1
\n", 23 | "In fact, all permutations of the diagonal board cannot be cleared in 3 laser shots. By permutations what I mean is that we exchange the row numbers of any 2 asteroids while keeping the column numbers the same, some examples are given below.
\n", 24 | "0 1 0 0   0 1 0 0   0 0 1 0
\n", 25 | "1 0 0 0\t \t1 0 0 0\t \t0 1 0 0
\n", 26 | "0 0 1 0\t \t0 0 0 1\t \t1 0 0 0
\n", 27 | "0 0 0 1\t \t0 0 1 0\t \t0 0 0 1
\n", 28 | "There will be 4! (=24) such boards. If any of the boards that we are given contain these boards then it cannot be cleared. In more mathematical terms, all matrices that can be cleared have permanent equal to 0. The permanent is a property similar to the determinant, please check it out on Wikipedia if you are not familiar with it. All the boards with 4 asteroids shown above have permanent equal to 1. When you have six asteroids it is possible to have matrices with permanent equal to 0, 1 and 2 while only matrices with permanent equal to 0 can be cleared. My approach was to first convert matrices with permanent equal to 2 to matrices with permanent equal to 1 (I will explain how later). Then all matrices with permanent equal to 1 were phase flipped (pi-phase) as is done in Grover’s algorithm.\n", 29 | "# 2. QRAM implementation\n", 30 | "The boards' data is loaded using a QRAM structure with 4 address qubits, 16 data qubits and a total of 3 ancillary qubits. The order of 'writes' is a 4-bit Gray code sequence starting from 1111, i.e.,
\n", 31 | " 1111 → 1110 → 1010→1011 →1001→1000→0000→ 0001→0011→ 0010→0110→0111→0101→0100→1100→1101
\n", 32 | "This way, only one-bit changes between subsequent writes, which minimizes the un-computations that is necessary between different addresses.\n", 33 | "# 3. Oracle\n", 34 | "My oracle checks for the presence of one of the 24 boards with 4 asteroids and permanent equal to 1 and applies a phase flip if present. However, there is a possibility of the 6-asteroid boards to have permanent equal to 2, for example:
\n", 35 | "1 1 0 0
\n", 36 | "1 1 0 0
\n", 37 | "0 0 1 0
\n", 38 | "0 0 0 1
\n", 39 | "which would trigger the phase flip twice corresponding to the two boards:
\n", 40 | "1 0 0 0 \t\t0 1 0 0
\n", 41 | "0 1 0 0 \t\t1 0 0 0
\n", 42 | "0 0 1 0 \t\t0 0 1 0
\n", 43 | "0 0 0 1 \t\t0 0 0 1
\n", 44 | "We account for this by converting all matrices with permanent equal to 2 to matrices with permanent equal to 1.\n", 45 | "# 4. Converting permanent=2 to permanent=1\n", 46 | "We carry out this step inside the QRAM implementation while initializing the data qubits. We see that the above example of a matrix with permanent equal to 2:
\n", 47 | "1 1 0 0
\n", 48 | "1 1 0 0
\n", 49 | "0 0 1 0
\n", 50 | "0 0 0 1
\n", 51 | "becomes a matrix with permanent equal to 1 if we simply don't initialize one of the four 1's:
\n", 52 | "1 0 0 0 \t\t0 1 0 0 \t\t0 0 0 0 \t\t0 0 0 0
\n", 53 | "0 0 0 0 \t\t0 0 0 0 \t\t1 0 0 0 \t\t0 1 0 0
\n", 54 | "0 0 0 0 \t\t0 0 0 0 \t\t0 0 0 0 \t\t0 0 0 0
\n", 55 | "0 0 0 0 \t\t0 0 0 0 \t\t0 0 0 0 \t\t0 0 0 0
\n", 56 | "This can be achieved by simply making use of some if-else conditions, but need to be done carefully to ensure that matrices with permanent =1 initially do not get converted to matrices with permanent =0.\n", 57 | "# 5. The Whole circuit\n", 58 | "The complete circuit is then composed of:
\n", 59 | " 1.Initialization
\n", 60 | " 2.QRAM
\n", 61 | " 3.Oracle
\n", 62 | " 4.Inverse QRAM
\n", 63 | " 5.Diffusion
\n", 64 | "Inverse QRAM is just QRAM with the order of operations reversed. Qubit 0-3 are the address qubits and 4-19 are data qubits the rest are ancilla qubits which assist in various operations.\n" 65 | ] 66 | }, 67 | { 68 | "cell_type": "code", 69 | "execution_count": null, 70 | "metadata": {}, 71 | "outputs": [], 72 | "source": [ 73 | "problem_set = \\\n", 74 | " [[['0', '2'], ['1', '0'], ['1', '2'], ['1', '3'], ['2', '0'], ['3', '3']],\n", 75 | " [['0', '0'], ['0', '1'], ['1', '2'], ['2', '2'], ['3', '0'], ['3', '3']],\n", 76 | " [['0', '0'], ['1', '1'], ['1', '3'], ['2', '0'], ['3', '2'], ['3', '3']],\n", 77 | " [['0', '0'], ['0', '1'], ['1', '1'], ['1', '3'], ['3', '2'], ['3', '3']],\n", 78 | " [['0', '2'], ['1', '0'], ['1', '3'], ['2', '0'], ['3', '2'], ['3', '3']],\n", 79 | " [['1', '1'], ['1', '2'], ['2', '0'], ['2', '1'], ['3', '1'], ['3', '3']],\n", 80 | " [['0', '2'], ['0', '3'], ['1', '2'], ['2', '0'], ['2', '1'], ['3', '3']],\n", 81 | " [['0', '0'], ['0', '3'], ['1', '2'], ['2', '2'], ['2', '3'], ['3', '0']],\n", 82 | " [['0', '3'], ['1', '1'], ['1', '2'], ['2', '0'], ['2', '1'], ['3', '3']],\n", 83 | " [['0', '0'], ['0', '1'], ['1', '3'], ['2', '1'], ['2', '3'], ['3', '0']],\n", 84 | " [['0', '1'], ['0', '3'], ['1', '2'], ['1', '3'], ['2', '0'], ['3', '2']],\n", 85 | " [['0', '0'], ['1', '3'], ['2', '0'], ['2', '1'], ['2', '3'], ['3', '1']],\n", 86 | " [['0', '1'], ['0', '2'], ['1', '0'], ['1', '2'], ['2', '2'], ['2', '3']],\n", 87 | " [['0', '3'], ['1', '0'], ['1', '3'], ['2', '1'], ['2', '2'], ['3', '0']],\n", 88 | " [['0', '2'], ['0', '3'], ['1', '2'], ['2', '3'], ['3', '0'], ['3', '1']],\n", 89 | " [['0', '1'], ['1', '0'], ['1', '2'], ['2', '2'], ['3', '0'], ['3', '1']]]\n", 90 | "def week3_ans_func(problem_set):\n", 91 | " ##### build your quantum circuit here\n", 92 | " ##### In addition, please make it a function that can solve the problem even with different inputs (problem_set). We do validation with different inputs. \n", 93 | " qc=QuantumCircuit(27,4)\n", 94 | " k1=[[1,1],[1,0],[0,0],[0,1]]\n", 95 | " k2=[[0,1],[0,0],[1,0],[1,1]]\n", 96 | " qc.h([0,1,2,3])\n", 97 | " qc.ccx(0,1,25)\n", 98 | " qc.ccx(2,3,26)\n", 99 | " qc.ccx(25,26,24)\n", 100 | " rc=np.zeros((16,8))\n", 101 | " for i in k1: # qram operation\n", 102 | " if i[0]==1:\n", 103 | " if i[1]==0:\n", 104 | " qc.cx(0,25)\n", 105 | " qc.ccx(0,26,24)\n", 106 | " if i[0]==0:\n", 107 | " if i[1]==0:\n", 108 | " qc.x(1)\n", 109 | " qc.cx(1,25)\n", 110 | " qc.ccx(1,26,24) \n", 111 | " qc.x(1)\n", 112 | " if i[0]==0:\n", 113 | " if i[1]==1:\n", 114 | " qc.x(0)\n", 115 | " qc.cx(0,25)\n", 116 | " qc.ccx(0,26,24)\n", 117 | " qc.x(0)\n", 118 | " for j in k1: \n", 119 | " if j[0]==1:\n", 120 | " if j[1]==0:\n", 121 | " qc.ccx(2,25,24)\n", 122 | " if j[0]==0:\n", 123 | " if j[1]==0:\n", 124 | " qc.x(3)\n", 125 | " qc.ccx(3,25,24)\n", 126 | " qc.x(3) \n", 127 | " if j[0]==0:\n", 128 | " if j[1]==1:\n", 129 | " qc.x(2)\n", 130 | " qc.ccx(2,25,24)\n", 131 | " qc.x(2)\n", 132 | " i0=int(i[0])\n", 133 | " i1=int(i[1])\n", 134 | " j0=int(j[0])\n", 135 | " j1=int(j[1])\n", 136 | " c=0\n", 137 | " for m in range(6):\n", 138 | " k=problem_set[i0*8+i1*4+j0*2+j1][m]\n", 139 | " k00=int(k[0])\n", 140 | " k11=int(k[1])\n", 141 | " if (rc[i0*8+i1*4+j0*2+j1][k00]==0 or rc[i0*8+i1*4+j0*2+j1][k11+4]==0) or c==0:\n", 142 | " qc.cx(24,k00*4+k11+4)\n", 143 | " rc[i0*8+i1*4+j0*2+j1][k00]+=1\n", 144 | " rc[i0*8+i1*4+j0*2+j1][k11+4]+=1\n", 145 | " if c==0 and (rc[i0*8+i1*4+j0*2+j1][k00]==2 or rc[i0*8+i1*4+j0*2+j1][k11+4]==2):\n", 146 | " for n in range(m+1):\n", 147 | " l=problem_set[i0*8+i1*4+j0*2+j1][n]\n", 148 | " l00=int(l[0])\n", 149 | " l11=int(l[1])\n", 150 | " if (rc[i0*8+i1*4+j0*2+j1][l00]>1 and rc[i0*8+i1*4+j0*2+j1][l11+4]>1):\n", 151 | " c+=1\n", 152 | " \n", 153 | " if j[0]==0:\n", 154 | " if j[1]==1:\n", 155 | " qc.ccx(3,25,24)\n", 156 | " \n", 157 | " p=[[0,1,2,3],[0,2,1,3],[0,3,1,2]]#oracle\n", 158 | " for q in p:\n", 159 | " qc.ccx([q[0]+4,q[1]+4,q[2]+12,q[3]+12],[q[1]+8,q[0]+8,q[3]+16,q[2]+16],[20,21,22,23])\n", 160 | " qc.cz([20,21,20,21],[22,22,23,23])\n", 161 | " qc.ccx([q[0]+4,q[1]+4,q[2]+12,q[3]+12],[q[1]+8,q[0]+8,q[3]+16,q[2]+16],[20,21,22,23])\n", 162 | " qc.ccx([q[2]+4,q[3]+4,q[0]+12,q[1]+12],[q[3]+8,q[2]+8,q[1]+16,q[0]+16],[20,21,22,23])\n", 163 | " qc.cz([20,21,20,21],[22,22,23,23])\n", 164 | " qc.ccx([q[2]+4,q[3]+4,q[0]+12,q[1]+12],[q[3]+8,q[2]+8,q[1]+16,q[0]+16],[20,21,22,23])\n", 165 | " \n", 166 | " rc=np.zeros((16,8)) \n", 167 | "\n", 168 | " for i in k2: # inverse_qram operation\n", 169 | " for j in k2:\n", 170 | " if j[0]==0:\n", 171 | " if j[1]==1:\n", 172 | " qc.ccx(3,25,24)\n", 173 | " i0=int(i[0])\n", 174 | " i1=int(i[1])\n", 175 | " j0=int(j[0])\n", 176 | " j1=int(j[1])\n", 177 | " c=0\n", 178 | " for m in range(6):\n", 179 | " k=problem_set[i0*8+i1*4+j0*2+j1][m]\n", 180 | " k00=int(k[0])\n", 181 | " k11=int(k[1])\n", 182 | " if (rc[i0*8+i1*4+j0*2+j1][k00]==0 or rc[i0*8+i1*4+j0*2+j1][k11+4]==0) or c==0:\n", 183 | " qc.cx(24,k00*4+k11+4)\n", 184 | " rc[i0*8+i1*4+j0*2+j1][k00]+=1\n", 185 | " rc[i0*8+i1*4+j0*2+j1][k11+4]+=1\n", 186 | " if c==0 and (rc[i0*8+i1*4+j0*2+j1][k00]==2 or rc[i0*8+i1*4+j0*2+j1][k11+4]==2):\n", 187 | " for n in range(m+1):\n", 188 | " l=problem_set[i0*8+i1*4+j0*2+j1][n]\n", 189 | " l00=int(l[0])\n", 190 | " l11=int(l[1])\n", 191 | " if (rc[i0*8+i1*4+j0*2+j1][l00]>1 and rc[i0*8+i1*4+j0*2+j1][l11+4]>1):\n", 192 | " c+=1\n", 193 | "\n", 194 | " if j[0]==1:\n", 195 | " if j[1]==0:\n", 196 | " qc.ccx(2,25,24)\n", 197 | " if j[0]==0:\n", 198 | " if j[1]==0:\n", 199 | " qc.x(3)\n", 200 | " qc.ccx(3,25,24)\n", 201 | " qc.x(3) \n", 202 | " if j[0]==0:\n", 203 | " if j[1]==1:\n", 204 | " qc.x(2)\n", 205 | " qc.ccx(2,25,24)\n", 206 | " qc.x(2)\n", 207 | " if i[0]==1:\n", 208 | " if i[1]==0:\n", 209 | " qc.cx(0,25)\n", 210 | " qc.ccx(0,26,24)\n", 211 | " if i[0]==0:\n", 212 | " if i[1]==0:\n", 213 | " qc.x(1)\n", 214 | " qc.cx(1,25)\n", 215 | " qc.ccx(1,26,24) \n", 216 | " qc.x(1)\n", 217 | " if i[0]==0:\n", 218 | " if i[1]==1:\n", 219 | " qc.x(0)\n", 220 | " qc.cx(0,25)\n", 221 | " qc.ccx(0,26,24)\n", 222 | " qc.x(0)\n", 223 | " qc.ccx(25,26,24)\n", 224 | " qc.ccx(0,1,25)\n", 225 | " qc.ccx(2,3,26)\n", 226 | "\n", 227 | "\n", 228 | " for k in range(4):\n", 229 | " qc.h(k)\n", 230 | " qc.x(k)\n", 231 | " qc.ccx(0,1,24)\n", 232 | " qc.ccx(2,3,25)\n", 233 | " qc.cz(24,25)\n", 234 | " qc.ccx(2,3,25)\n", 235 | " qc.ccx(0,1,24)\n", 236 | " for k in range(4):\n", 237 | " qc.x(k)\n", 238 | " qc.h(k)\n", 239 | "\n", 240 | " for a in range(4):\n", 241 | " qc.measure(a,a)\n", 242 | " #### Code for Grover's algorithm with iterations = 1 will be as follows. \n", 243 | " #### for i in range(1):\n", 244 | " #### oracle()\n", 245 | " #### diffusion()\n", 246 | " \n", 247 | " return qc" 248 | ] 249 | } 250 | ], 251 | "metadata": { 252 | "kernelspec": { 253 | "display_name": "Python 3", 254 | "language": "python", 255 | "name": "python3" 256 | }, 257 | "language_info": { 258 | "codemirror_mode": { 259 | "name": "ipython", 260 | "version": 3 261 | }, 262 | "file_extension": ".py", 263 | "mimetype": "text/x-python", 264 | "name": "python", 265 | "nbconvert_exporter": "python", 266 | "pygments_lexer": "ipython3", 267 | "version": "3.8.3" 268 | } 269 | }, 270 | "nbformat": 4, 271 | "nbformat_minor": 4 272 | } 273 | -------------------------------------------------------------------------------- /submissions/writeup_klukowski.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Introduction\n", 8 | "\n", 9 | "### Abstract\n", 10 | "\n", 11 | "This is a solution for final problem from Autumn 2020 IBM Quantum Challenge. It uses the permutation approach, giving the circuit cost equal 6409. The main idea is to use an oracle with phase factor of $e^\\frac{2 \\pi i}{3}$ instead of $-1$ as in standard Grover's algorithm.\n", 12 | "\n", 13 | "If you have any comments/questions, do not hesitate to contact me on qiskit Slack (adam klukowski) or at ak2028@cam.ac.uk.\n", 14 | "\n", 15 | "### Problem statement\n", 16 | "\n", 17 | "We are given 16 boards of dimensions 4x4 with six asteroids on each. Using a laser beam we can remove all asteroids on a chosen row/column. The task is to find the unique board that cannot be cleaned with at most three laser shots (it is allowed to use vertical and horizontal beams at the same time). We are asked to use Grover's algorithm with one iteration.\n", 18 | "\n", 19 | "### Approach overview and motivation\n", 20 | "\n", 21 | "Our circuit will use straightforward architecture:\n", 22 | " - Hadamard gates, to create equal superposition of address qubits\n", 23 | " - qRAM, to entangle address qubits with data qubits\n", 24 | " - oracle acting on data qubits\n", 25 | " - uncomputing qRAM\n", 26 | " - diffuser acting on address qubits\n", 27 | "\n", 28 | "The oracle uses the following fact: a board is unsolvable iff it contains four asteroids with no two on the same row or column (a permutation matrix). Finding such arrangement can be thought of as a **dual problem** - each laser beam can eliminate at most one asteroid from such collection, so it is a \"certificate\" that we need at least four shots.\n", 29 | "\n", 30 | "Naive way would be to iterate over all 24 permutations and apply CCCZ to each. This does not work - we may encounter a board with exactly two permutations, and two phase factors would cancel. Instead, we will use controlled rotation by $\\frac{2\\pi}{3}$; this way unsolvable boards will acquire phase factor of $\\omega$ or $\\omega^2$, where $\\omega$ is primitive third root of unity.\n", 31 | "\n", 32 | "The idea for qRAM is inspired by linear algebra over field of two elements. The circuit consists of a part that looks like a map from address states to basis of $\\mathbb{Z}_2^{16}$, and another part that resembles a linear map.\n", 33 | "\n", 34 | "### Impact of a different phase factor\n", 35 | "\n", 36 | "It is natural to ask if full Grover's algorithm, beyond single iteration, is still possible with such oracle. It turns out that single oracle is not enough - one can obtain some aplification, but the amplitude will be bounded away from 1 (e.g. when searching among 1024 elements, the highest achievable probability of measuring the correct one is about 1%). However, we can overcome this by alternating between using phase factors $\\omega = e^\\frac{2 \\pi i}{3}$ and $\\omega^2 = e^\\frac{-2 \\pi i}{3}$. This comes at a cost: the rotation angle is smaller, so we need to apply a bit more iterations (still $O(\\sqrt{size})$, but with a bigger constant)." 37 | ] 38 | }, 39 | { 40 | "cell_type": "code", 41 | "execution_count": 1, 42 | "metadata": {}, 43 | "outputs": [], 44 | "source": [ 45 | "# imports\n", 46 | "from itertools import combinations\n", 47 | "from math import pi\n", 48 | "from qiskit import Aer, execute, QuantumCircuit, QuantumRegister, ClassicalRegister\n", 49 | "from qiskit.circuit.library import RCCXGate\n", 50 | "from qiskit.transpiler import PassManager\n", 51 | "from qiskit.transpiler.passes import Unroller\n", 52 | "\n", 53 | "# original input\n", 54 | "problem_set = \\\n", 55 | " [[['0', '2'], ['1', '0'], ['1', '2'], ['1', '3'], ['2', '0'], ['3', '3']],\n", 56 | " [['0', '0'], ['0', '1'], ['1', '2'], ['2', '2'], ['3', '0'], ['3', '3']],\n", 57 | " [['0', '0'], ['1', '1'], ['1', '3'], ['2', '0'], ['3', '2'], ['3', '3']],\n", 58 | " [['0', '0'], ['0', '1'], ['1', '1'], ['1', '3'], ['3', '2'], ['3', '3']],\n", 59 | " [['0', '2'], ['1', '0'], ['1', '3'], ['2', '0'], ['3', '2'], ['3', '3']],\n", 60 | " [['1', '1'], ['1', '2'], ['2', '0'], ['2', '1'], ['3', '1'], ['3', '3']],\n", 61 | " [['0', '2'], ['0', '3'], ['1', '2'], ['2', '0'], ['2', '1'], ['3', '3']],\n", 62 | " [['0', '0'], ['0', '3'], ['1', '2'], ['2', '2'], ['2', '3'], ['3', '0']],\n", 63 | " [['0', '3'], ['1', '1'], ['1', '2'], ['2', '0'], ['2', '1'], ['3', '3']],\n", 64 | " [['0', '0'], ['0', '1'], ['1', '3'], ['2', '1'], ['2', '3'], ['3', '0']],\n", 65 | " [['0', '1'], ['0', '3'], ['1', '2'], ['1', '3'], ['2', '0'], ['3', '2']],\n", 66 | " [['0', '0'], ['1', '3'], ['2', '0'], ['2', '1'], ['2', '3'], ['3', '1']],\n", 67 | " [['0', '1'], ['0', '2'], ['1', '0'], ['1', '2'], ['2', '2'], ['2', '3']],\n", 68 | " [['0', '3'], ['1', '0'], ['1', '3'], ['2', '1'], ['2', '2'], ['3', '0']],\n", 69 | " [['0', '2'], ['0', '3'], ['1', '2'], ['2', '3'], ['3', '0'], ['3', '1']],\n", 70 | " [['0', '1'], ['1', '0'], ['1', '2'], ['2', '2'], ['3', '0'], ['3', '1']]]\n", 71 | "\n", 72 | "# unroll and print cost\n", 73 | "def print_cost(qc):\n", 74 | " ops = PassManager(Unroller(['u3', 'cx'])).run(qc).count_ops()\n", 75 | " print(ops, ', cost', ops['u3'] + 10 * ops['cx'])" 76 | ] 77 | }, 78 | { 79 | "cell_type": "markdown", 80 | "metadata": {}, 81 | "source": [ 82 | "# Preprocessing\n", 83 | "\n", 84 | "We start with classical preprocessing. This function converts boards from list of coordinate pairs to list of asteroid indices. Indices range from 0 for ['0', '0'] to 15 for ['3', '3']. Repeated boards are problematic for this implementation of qRAM, so they are replaced with something solvable." 85 | ] 86 | }, 87 | { 88 | "cell_type": "code", 89 | "execution_count": 2, 90 | "metadata": {}, 91 | "outputs": [], 92 | "source": [ 93 | "def preprocess(problem_set):\n", 94 | " \n", 95 | " # convert boards into lists of asteroid indices\n", 96 | " problem_set = [sorted([4 * int(i) + int(j) for i, j in board]) for board in problem_set]\n", 97 | " \n", 98 | " # remove repetitions\n", 99 | " repeated = 0\n", 100 | " for i in range(16):\n", 101 | " for j in range(i):\n", 102 | " if problem_set[i] == problem_set[j]:\n", 103 | " problem_set[i] = [repeated]\n", 104 | " repeated += 1\n", 105 | " \n", 106 | " return problem_set" 107 | ] 108 | }, 109 | { 110 | "cell_type": "markdown", 111 | "metadata": {}, 112 | "source": [ 113 | "# qRAM\n", 114 | "\n", 115 | "### Architecture\n", 116 | "\n", 117 | "qRAM consists of two parts:\n", 118 | " - Generic circuit calculating power of 2\n", 119 | " - Problemset-dependent circuit operating only on data qubits, expanding n-th qubit into the encoding of n-th board\n", 120 | "\n", 121 | "The idea comes from linear algebra: first circuit can be treated as sending address states to canonical basis of $\\mathbb{Z}_2^{16}$, and the second one as a linear map $\\mathbb{Z}_2^{16} \\rightarrow \\mathbb{Z}_2^{16}$, sending canonical basis vectors to board encodings. However, in reality the second function is not linear, it only pretends to be.\n", 122 | "\n", 123 | "### Power of 2\n", 124 | "\n", 125 | "##### Function\n", 126 | "\n", 127 | "qram_power_of_2 sends\n", 128 | "$$ \\lvert n \\rangle \\lvert 0 \\rangle \\mapsto \\lvert n \\rangle \\lvert 2^n \\rangle = \\lvert n \\rangle \\lvert 0_0 \\dots 0_{n-1} 1_n 0_{n+1} \\dots 0_{16} \\rangle $$\n", 129 | "i.e. entangles state $\\lvert n \\rangle$ of address qubits with $n$-th data qubit.\n", 130 | "\n", 131 | "##### Implementation\n", 132 | "\n", 133 | "First we entangle address state $\\lvert n \\rangle$ with a subset of data qubits that contains the $n$-th. Equivalently, we send\n", 134 | "$$ \\lvert n \\rangle \\lvert 0 \\rangle \\mapsto \\lvert n \\rangle \\lvert m \\rangle $$\n", 135 | "for some $m$ whose n-th binary digit is 1.\n", 136 | "\n", 137 | "Then, we eliminate the undesired entanglements.\n", 138 | "\n", 139 | "This is much clearer if we track the following: for $n$-th data qubit, what are the address states that can give 1 as its measurement?\n", 140 | "\n", 141 | "After first part we have chosen data qubits entandled with\n", 142 | "\n", 143 | " \n", 144 | " \n", 145 | " \n", 146 | " \n", 147 | " \n", 148 | " \n", 149 | " \n", 150 | " \n", 151 | " \n", 152 | " \n", 153 | "
data qubitaddress states that have $\\lvert 1 \\rangle$ there
0everything (always in state $\\lvert 1 \\rangle$)
11, 5, 9, 13
22, 6, 10, 14
33, 7, 11, 15
77, 15
1111, 15
1212, 13, 14, 15
1313, 15
1515
\n", 154 | "Then, we eliminate extra entaglements by taking symmetric differences. This is done by using CX gates: each CX(a, b) translates to xoring b-th subset with a-th subset. We ensure that we always xor a set with its subset with exactly half as many elements (e.g. CX(7, 3) changes set of 3 to $\\{3, 7, 11, 15\\} \\triangle \\{7, 15\\} = \\{3, 11\\}$).\n", 155 | "\n", 156 | "### Expansion\n", 157 | "\n", 158 | "##### Function\n", 159 | "\n", 160 | "qram_expand sends\n", 161 | "$$\\begin{align}\n", 162 | "\\lvert 2^n \\rangle = \\lvert 0_0 \\dots 1_n \\dots 0_{16} \\rangle \\mapsto \\lvert 0_0 \\dots 1_{a_1} \\dots \\dots \\dots 1_{a_6} \\dots 0_{16} \\rangle \\\\\n", 163 | "\\text{where } a_1, \\dots, a_6 \\text{ are positions of asteroids on n-th board}\n", 164 | "\\end{align}$$\n", 165 | "\n", 166 | "##### Implementation\n", 167 | "\n", 168 | "This is arguably the least elegant bit of this solution.\n", 169 | "\n", 170 | "The first idea is to iterate over each board, and add CX(data[n], data[$a_i$]) for each $a_i$ in n-th board - hoping that $n$-th qubit will flip all the asteroids from $n$-th board.\n", 171 | "\n", 172 | "However, this will mix different boards and produce a mess. Therefore we will build this circuit inductively from layers:\n", 173 | " - Suppose we have the circuit for boards 0 to $i-1$\n", 174 | " - We compute the input state $\\lvert \\psi \\rangle$ that will result in the $i$-th board. This is easy thanks to unitarity: we can prepare the state of $i$-th board, run the circuit _backwards_, and measure $\\lvert \\psi \\rangle$\n", 175 | " - Prefix our circuit with a layer that sends $\\lvert 2^i \\rangle$ to $\\lvert \\psi \\rangle$ and does not change $\\lvert 2^j \\rangle$ for $j:15: DeprecationWarning: The QuantumCircuit.cu1 method is deprecated as of 0.16.0. It will be removed no earlier than 3 months after the release date. You should use the QuantumCircuit.cp method instead, which acts identically.\n", 304 | " o.cu1(parity * 2 * pi / 3, ancilla[a1], ancilla[a2])\n" 305 | ] 306 | } 307 | ], 308 | "source": [ 309 | "def oracle(data, ancilla, parity = 0):\n", 310 | " parity = 2 * parity - 1\n", 311 | " o = QuantumCircuit(data, ancilla)\n", 312 | " for col0, col1 in combinations([0, 1, 2, 3], 2):\n", 313 | " \n", 314 | " # rem_col are the columns for asteroids in two bottom rows\n", 315 | " rem_col = [i for i in range(4) if i!=col0 and i!=col1]\n", 316 | " \n", 317 | " # entangle pair of cells with ancillas\n", 318 | " for a, d1, d2 in [(0, col0, 4 + col1), (1, col1, 4 + col0), (2, 8 + rem_col[0], 12 + rem_col[1]), (3, 8 + rem_col[1], 12 + rem_col[0])]:\n", 319 | " o.append(RCCXGate(), [data[d1], data[d2], ancilla[a]])\n", 320 | " \n", 321 | " # apply phase factor\n", 322 | " for a1, a2 in [(0, 2), (0, 3), (1, 2), (1, 3)]:\n", 323 | " o.cu1(parity * 2 * pi / 3, ancilla[a1], ancilla[a2])\n", 324 | " \n", 325 | " # uncompute the entanglement\n", 326 | " for a, d1, d2 in [(0, col0, 4 + col1), (1, col1, 4 + col0), (2, 8 + rem_col[0], 12 + rem_col[1]), (3, 8 + rem_col[1], 12 + rem_col[0])]:\n", 327 | " o.append(RCCXGate(), [data[d1], data[d2], ancilla[a]])\n", 328 | " \n", 329 | " return o\n", 330 | "\n", 331 | "print_cost(oracle(QuantumRegister(16), QuantumRegister(4)))" 332 | ] 333 | }, 334 | { 335 | "cell_type": "markdown", 336 | "metadata": {}, 337 | "source": [ 338 | "# Putting it together" 339 | ] 340 | }, 341 | { 342 | "cell_type": "code", 343 | "execution_count": 5, 344 | "metadata": {}, 345 | "outputs": [ 346 | { 347 | "name": "stdout", 348 | "output_type": "stream", 349 | "text": [ 350 | "diffuser: OrderedDict([('u3', 39), ('cx', 12)]) , cost 159\n", 351 | "overall: OrderedDict([('cx', 586), ('u3', 549), ('measure', 4)]) , cost 6409\n" 352 | ] 353 | } 354 | ], 355 | "source": [ 356 | "def diffusion(addr, ancilla):\n", 357 | " diff = QuantumCircuit(addr, ancilla)\n", 358 | " diff.h(addr)\n", 359 | " diff.x(addr)\n", 360 | " diff.h(addr[0])\n", 361 | " diff.mcx(addr[1:], addr[0], ancilla, 'v-chain')\n", 362 | " diff.h(addr[0])\n", 363 | " diff.x(addr)\n", 364 | " diff.h(addr)\n", 365 | " return diff\n", 366 | "def week3_ans_func(problem_set):\n", 367 | " \n", 368 | " problem_set = preprocess(problem_set)\n", 369 | " \n", 370 | " addr, data, anc, cr = QuantumRegister(4), QuantumRegister(16), QuantumRegister(4), ClassicalRegister(4)\n", 371 | " \n", 372 | " ram = QuantumCircuit(addr, data)\n", 373 | " ram += qram_power_of_2(addr, data)\n", 374 | " ram += qram_expand(problem_set, data)\n", 375 | " \n", 376 | " qc = QuantumCircuit(addr, data, anc, cr)\n", 377 | " qc.h(addr)\n", 378 | " \n", 379 | " for i in range(1): # modify to use more iterations\n", 380 | " qc += ram\n", 381 | " qc += oracle(data, anc, i % 2)\n", 382 | " qc += ram.reverse_ops()\n", 383 | " qc += diffusion(addr, anc)\n", 384 | " \n", 385 | " qc.measure(addr, cr[::-1])\n", 386 | " \n", 387 | " return qc\n", 388 | "\n", 389 | "print('diffuser:', end = ' ')\n", 390 | "print_cost(diffusion(QuantumRegister(4), QuantumRegister(4)))\n", 391 | "print('overall:', end = ' ')\n", 392 | "print_cost(week3_ans_func(problem_set))" 393 | ] 394 | }, 395 | { 396 | "cell_type": "markdown", 397 | "metadata": {}, 398 | "source": [ 399 | "# Result" 400 | ] 401 | }, 402 | { 403 | "cell_type": "code", 404 | "execution_count": 4, 405 | "metadata": {}, 406 | "outputs": [ 407 | { 408 | "name": "stdout", 409 | "output_type": "stream", 410 | "text": [ 411 | "Running week3_ans_func...\n", 412 | "Computing cost...\n", 413 | "Starting experiments. Please wait...\n", 414 | "You may monitor the job (id: 5fc3d36fe15c3b00192d39c8) status and proceed to grading when it successfully completes.\n" 415 | ] 416 | }, 417 | { 418 | "data": { 419 | "text/plain": [ 420 | "{'0000': 41,\n", 421 | " '0001': 39,\n", 422 | " '0010': 51,\n", 423 | " '0011': 35,\n", 424 | " '0100': 43,\n", 425 | " '0101': 359,\n", 426 | " '0110': 47,\n", 427 | " '0111': 46,\n", 428 | " '1000': 48,\n", 429 | " '1001': 50,\n", 430 | " '1010': 42,\n", 431 | " '1011': 36,\n", 432 | " '1100': 36,\n", 433 | " '1101': 43,\n", 434 | " '1110': 41,\n", 435 | " '1111': 43}" 436 | ] 437 | }, 438 | "execution_count": 4, 439 | "metadata": {}, 440 | "output_type": "execute_result" 441 | } 442 | ], 443 | "source": [ 444 | "# Submission code\n", 445 | "from qc_grader import grade_ex3, prepare_ex3, submit_ex3\n", 446 | "\n", 447 | "# Execute your circuit with following prepare_ex3() function.\n", 448 | "# The prepare_ex3() function works like the execute() function with only QuantumCircuit as an argument.\n", 449 | "job = prepare_ex3(week3_ans_func)\n", 450 | "\n", 451 | "result = job.result()\n", 452 | "counts = result.get_counts()\n", 453 | "original_problem_set_counts = counts[0]\n", 454 | "\n", 455 | "original_problem_set_counts\n", 456 | "# The bit string with the highest number of observations is treated as the solution." 457 | ] 458 | }, 459 | { 460 | "cell_type": "code", 461 | "execution_count": 5, 462 | "metadata": {}, 463 | "outputs": [ 464 | { 465 | "name": "stdout", 466 | "output_type": "stream", 467 | "text": [ 468 | "Grading your answer. Please wait...\n", 469 | "\n", 470 | "Congratulations 🎉! Your answer is correct.\n", 471 | "Your score is 6409.\n", 472 | "The lower your score the better!\n", 473 | "Feel free to submit your answer.\n" 474 | ] 475 | } 476 | ], 477 | "source": [ 478 | "# Check your answer by executing following code.\n", 479 | "# The quantum cost of the QuantumCircuit is obtained as the score. The lower the cost, the better.\n", 480 | "grade_ex3(job)" 481 | ] 482 | }, 483 | { 484 | "cell_type": "code", 485 | "execution_count": 6, 486 | "metadata": {}, 487 | "outputs": [ 488 | { 489 | "name": "stdout", 490 | "output_type": "stream", 491 | "text": [ 492 | "Submitting your answer. Please wait...\n", 493 | "\n", 494 | "Success 🎉! Your answer has been submitted.\n", 495 | "Congratulations! You have rescued Dr. Ryoko from the quantum realm. The bright \"quantum future\" is ahead.\n" 496 | ] 497 | } 498 | ], 499 | "source": [ 500 | "# Submit your results by executing following code. You can submit as many times as you like during the period. \n", 501 | "submit_ex3(job)" 502 | ] 503 | } 504 | ], 505 | "metadata": { 506 | "kernelspec": { 507 | "display_name": "Python 3", 508 | "language": "python", 509 | "name": "python3" 510 | }, 511 | "language_info": { 512 | "codemirror_mode": { 513 | "name": "ipython", 514 | "version": 3 515 | }, 516 | "file_extension": ".py", 517 | "mimetype": "text/x-python", 518 | "name": "python", 519 | "nbconvert_exporter": "python", 520 | "pygments_lexer": "ipython3", 521 | "version": "3.9.0" 522 | } 523 | }, 524 | "nbformat": 4, 525 | "nbformat_minor": 2 526 | } 527 | -------------------------------------------------------------------------------- /submissions/writeup_tulowiecki.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiskit-community/IBMQuantumChallenge2020/b96e2c1551048d3df4d925bdfb0fbbd7688f3522/submissions/writeup_tulowiecki.pdf --------------------------------------------------------------------------------