GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Friday, 15 July 2022

[Solution] Mark and the Online Exam Codeforces Solution



F. Mark and the Online Exam
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Mark is administering an online exam consisting of n true-false questions. However, he has lost all answer keys. He needs a way to retrieve the answers before his client gets infuriated.

Fortunately, he has access to the grading system. Thus, for each query, you can input the answers to all n questions, and the grading system will output how many of them are correct.

He doesn't have much time, so he can use the grading system at most 675 times. Help Mark determine the answer keys.

Note that answer keys are fixed in advance and will not change

Solution Click Below:-  👉CLICK HERE👈
👇👇👇👇👇

depending on your queries.

Input

The first line of the input consists of an integer n (1n1000) — the number of questions.

Interaction

After reading n, you can start making queries to the grading system. For each query, print a line containing a

Mark and the Online Exam Codeforces Solution

Mark and Professor Koro Codeforces Solution

Mark and Lightbulbs Codeforces Solution

Mark and His Unfinished Essay Codeforces Solution

Mark the Dust Sweeper Codeforces Solution

Mark the Photographer Codeforces Solution

 string s of length n consisting of only letters 'T' and 'F'.

  • si='T' means that you answer the i-question true.
  • si='F' means that you answer the i-question false.

After a successful query, you should read an integer k (0kn) — the number of correct answers. If you read n, then you found the answers, and your program should not make any more queries.

If your program reads k=1 instead of the number of correct answers, it means that you either made an invalid query or exceeded the query limits. Exit immediately after receiving 1, and you will see Wrong answer verdict. Otherwise, you can get an arbitrary verdict because your solution will continue to read from a closed stream.

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

To hack, use the following format:

The first line contains an integer n (1n1000) — the number of questions.

The second line contains a string s of length n consisting of only 'T' and 'F' — the answer key.


No comments:

Post a Comment