Recover Array

All submissions for this problem are available.
There is an array $A$ of length $10^5$, consisting of zeroes and ones. You can ask queries about subarray sums. On a query $1 \leq l \leq r \leq 10^5$, you get the sum $A_l + A_{l + 1} + \ldots + A_r$. You can ask a maximum of $90000$ queries. Find the array $A$. ### Note: Don't forget to flush the standard output after printing each line. It can be done using fflush(stdout) in C/C++, System.out.flush() in Java and sys.stdout.flush() in Python. If you exceed $90000$ queries OR the $l, r$ asked in a query don't satisfy $1 \leq l \leq r \leq 10^5$, OR the array found by you in the end is not the same as array $A$, your program will get a Wrong Answer verdict. The input is fixed and the judge is not adaptive. ### Input and Output: To ask for the sum of the subarray from $l$ to $r$ output $1$ $l$ $r$. Once you know the array $A$, print $2$ $A_1$ $A_2 \cdots A_{10^5}$. Below is a sample interaction. For the sake of explanation, the array size is assumed to be $4$ here instead of $10^5$. The hidden array $A$ is $[1, 1, 0, 1]$ ###Sample Input and Output: ``` Input / Judge Feedback Your output / Your query 1 2 2 1 1 1 2 2 1 1 4 3 1 3 3 0 2 1 1 0 1 ``` ###EXPLANATION: According to the asked queries, $A_2 = 1$, $A_1 + A_2 = 2$, $A_1 + A_2 + A_3 + A_4 = 3$, $ A_3 = 0$. The only binary array $A$ that satisfies these equations is $[1, 1, 0, 1]$Author:  jtnydv25 
Tags  jtnydv25 
Date Added:  28112019 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, SQL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, R, COB, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 