Skip to content
Embercode
✕
Contest setup and the judgeQuick quiz

Fast I/O and the template

8 questions. Covers Fast input and output.

Questions 1 to 5 of 8

  1. 1. An AI wrote a C++ solution for a problem with 1,000,000 numbers. It reads with cin >> x in a loop, using default settings. The sample passes, but the judge reports time limit exceeded on the largest test. The algorithm is O(n). What is the first change to try?
  2. 2. Which line is the bug, and what does it do? ``python import sys data = sys.stdin.buffer.read().split() if data[0] == "3": print("three") ``
  3. 3. Which statements about ios::sync_with_stdio(false) are true?

    Pick every answer that is true.

  4. 4. An interactive program starts with cin.tie(nullptr);. It prints the query with cout << "? " << mid << '\n'; and then reads the judge's reply with cin. The judge reports TIMEOUT after 0 queries. Which change fixes it?
  5. 5. On the lesson's test file of 1,000,000 integers, the Python input() loop took a median of 1.70 s, and sys.stdin.buffer.read().split() took 0.32 s. How many seconds does the second version save?

    Type a number.

5 question(s) left on this page.

Typed answers ignore extra spaces and, for most questions, capital letters.