player begins the game from the 1-st stage and should beat the stages in expanding request of the stage number. The player dominates the match in the wake of beating the n-th stage.    There is all things considered one designated spot on each stage, and there is consistently a designated spot on the 1-st stage.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question
100%

Correct answer will be upvoted else Multiple Downvoted. Computer science.

player begins the game from the 1-st stage and should beat the stages in expanding request of the stage number. The player dominates the match in the wake of beating the n-th stage. 

 

There is all things considered one designated spot on each stage, and there is consistently a designated spot on the 1-st stage. Toward the start of the game, just the designated spot on the 1-st stage is initiated, and any remaining designated spots are deactivated. At the point when the player gets to the I-th stage that has a designated spot, that designated spot is initiated. 

 

For each attempt of a phase, the player can either beat the stage or bomb the stage. On the off chance that they beat the I-th stage, the player is moved to the i+1-st stage. On the off chance that they bomb the I-th stage, the player is moved to the latest designated spot they actuated, and they need to beat the stages after that designated spot once more. 

 

For instance, expect that n=4 and the designated spots are on the 1-st and 3-rd stages. The player begins at the 1-st stage. If they come up short on the 1-st stage, they need to retry the 1-st stage on the grounds that the designated spot on the 1-st stage is the latest designated spot they enacted. On the off chance that the player beats the 1-st stage, they're moved to the 2-nd stage. If they bomb it, they're sent back to the 1-st stage once more. If they beat both the 1-st stage and the 2-nd stage, they get to the 3-rd stage and the designated spot on the 3-rd stage is enacted. Presently at whatever point they fizzle on the 3-rd stage, or the 4-th stage subsequent to beating the 3-rd stage, they're sent back to the 3-rd stage. On the off chance that they beat both the 3-rd stage and the 4-th stage, they dominate the game. 

 

Gildong will fabricate the stages to have equivalent trouble. He needs you to track down any series of stages and designated spots utilizing all things considered 2000 phases, where the normal number of attempts over all stages is by and large k, for a player whose likelihood of beating each stage is actually 12. 

 

Input 

 

Each test contains at least one experiments. The principal line contains the number of experiments t (1≤t≤50). 

 

Each experiment contains precisely one line. The line comprises of a solitary integer k (1≤k≤1018) — the normal number of attempts over all stages Gildong needs to set for a player whose likelihood of beating each stage is by and large 12. 

 

Output 

 

For each experiment, print −1 in case it's difficult to develop such a progression of stages and designated spots utilizing all things considered 2000 phases. 

 

In any case, print two lines. The principal line ought to contain a solitary integer n (1≤n≤2000) – the number of stages. The subsequent line ought to contain n integers, where the I-th integer addresses whether the I-th stage has a designated spot. The I-th integer ought to be 0 if the I-th stage doesn't have a designated spot, and 1 if it has a designated spot. Note that the principal integer should be 1 as indicated by the portrayal.

 

 

Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Concepts in designing Database
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education