Skip to content
neoideasblog

neoideasblog

  • Home
    • Privacy Policy
    • About Us
    • Contact Us
    • Terms
  • Trivia
  • Results
  • Admit Cards
  • Sitemaps
  • Toggle search form

notepad.exe solution codeforces

Posted on April 23, 2022 By Admin No Comments on notepad.exe solution codeforces

notepad.exe solution codeforces

 

This is an interactive problem.

There are nn words in a text editor. The ii-th word has length lili (1≤li≤20001≤li≤2000). The array ll is hidden and only known by the grader.

The text editor displays words in lines, splitting each two words in a line with at least one space. Note that a line does not have to end with a space. Let the height of the text editor refer to the number of lines used. For the given width, the text editor will display words in such a way that the height is minimized.

More formally, suppose that the text editor has width ww. Let aa be an array of length k+1k+1 where 1=a1<a2<…<ak+1=n+11=a1<a2<…<ak+1=n+1. aa is a valid array if for all 1≤i≤k1≤i≤k, lai+1+lai+1+1+…+1+lai+1−1≤wlai+1+lai+1+1+…+1+lai+1−1≤w. Then the height of the text editor is the minimum kk over all valid arrays.

Note that if w<max(li)w<max(li), the text editor cannot display all the words properly and will crash, and the height of the text editor will be  instead.

ALSO READ:-   [Question] Which country has a town named Batman?

You can ask n+30n+30 queries. In one query, you provide a width ww. Then, the grader will return the height hwhw of the text editor when its width is ww.

Find the minimum area of the text editor, which is the minimum value of w⋅hww⋅hw over all ww for which hw≠hw≠0.

The lengths are fixed in advance. In other words, the interactor is not adaptive.

Input

The first and only line of input contains a single integer nn (1≤n≤20001≤n≤2000)  — the number of words on the text editor.

It is guaranteed that the hidden lengths lili satisfy 1≤li≤20001≤li≤2000.

Interaction

Begin the interaction by reading nn.

To make a query, print “? ww” (without quotes, 1≤w≤1091≤w≤109). Then you should read our response from standard input, that is, hwhw.

If your program has made an invalid query or has run out of tries, the interactor will terminate immediately and your program will get a verdict Wrong answer.

ALSO READ:-   [Question] The first Asian American in space was descended from what country?

To give the final answer, print “! areaarea” (without the quotes). Note that giving this answer is not counted towards the limit of n+30n+30 queries.

After printing a query do not forget to output end of line and flush the output. Otherwise, you will get Idleness limit exceeded. To do this, use:

  • fflush(stdout) or cout.flush() in C++;
  • System.out.flush() in Java;
  • flush(output) in Pascal;
  • stdout.flush() in Python;
  • see documentation for other languages.

Hacks

The first line of input must contain a single integer nn (1≤n≤20001≤n≤2000) — the number of words in the text editor.

The second line of input must contain exactly nn space-separated integers l1,l2,…,lnl1,l2,…,ln (1≤li≤20001≤li≤2000).

Example
input

Copy
4
? 1

? 9

? 16

! 32
output

Copy
0

4

2

Note

In the first test case, the words are {glory,to,ukraine,and,anton,trygub}{glory,to,ukraine,and,anton,trygub}, so l={5,2,7,3,5,6}l={5,2,7,3,5,6}.

ALSO READ:-   [Question] Which of these letters is NOT a Roman numeral?

If w=1w=1, then the text editor is not able to display all words properly and will crash. The height of the text editor is h1=h1=0, so the grader will return .

If w=9w=9, then a possible way that the words will be displayed on the text editor is:

  • glory__toglory__to
  • ukraine__ukraine__
  • and_antonand_anton
  • __trygub___trygub_

The height of the text editor is h9=4h9=4, so the grader will return 44.

If w=16w=16, then a possible way that the words will be displayed on the text editor is:

  • glory_to_ukraineglory_to_ukraine
  • and_anton_tryguband_anton_trygub

The height of the text editor is h16=2h16=2, so the grader will return 22.

We have somehow figured out that the minimum area of the text editor is 3232, so we answer it.

ANSWER

“Click Here“

Admin

I am the Founder and the creator of the blog neoideasblog.com where we share latest trivia questions and answers on a daily basis.

Trivia

Post navigation

Previous Post: Cyclic Rotation solution codeforces
Next Post: Array Shuffling solution codeforces

Related Posts

[Question] What is the most common street name in the U.S.? Trivia
[NEO] Which battle of the American Revolution shares its name with an Ivy League university? Trivia
[Question] What is a synonym for “remontant”? Trivia
Who keeps her Oscar for “The Reader” in her bathroom so guests to make their own acceptance speech in the mirror? Trivia
[Question] What is the most remote populated island in the world? Trivia
[Question] What game did Pooh invent by dropping a fir cone off a bridge? Trivia

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Archives

  • June 2022
  • May 2022
  • April 2022

Categories

  • Admit Cards
  • Results
  • Trivia

Disclaimer

Disclaimer: Our website name Neoideasblog.com. we are just a news portal that covers various updates and stories.

Copyright © 2022 neoideasblog.

Powered by PressBook Grid Blogs theme