#P99. Communicative Problem Test 2: Eventual Addition

Communicative Problem Test 2: Eventual Addition

Person in charge

Attention

This is a communicative problem.

You must strictly follow the submission guidelines!!!

Problem Description

Given two integers aa and bb, compute (a+b)mod(2311)(a + b) \mod (2^{31}-1).

However, there's a twist - you must perform the calculation in nn steps.

Evaluation Method

Your program will be executed n times. In each execution (you won't know which execution it is), your program must:

  1. Read three integers nn, xx, bb
  2. Output one integer.
  • First execution: x=ax = a
  • Subsequent executions: x=yx = y from previous execution
  • Final execution: yy must be equal to (a+b)mod(2311)(a + b) \mod (2^{31}-1)
  • Each execution must satisfy 0y23120 \le y \le 2^{31}-2

Important Notes

  1. Any attempt to attack the judge will be treated as cheating!
  2. Submission shouldn't exceed 10001000 lines and 10510^5 bytes.
  3. Compilation attributes: -O2 -std=c++14.
  4. Time limit: 1s over all runs; Memory limit: 512MB per run.

Constraints

1n20,0a,b2312.1 \le n \le 20,0 \le a,b \le 2^{31}-2.