atcoder#AGC047E. [AGC047E] Product Simulation
[AGC047E] Product Simulation
Score : points
Problem Statement
This is an output-only problem. You shouldn't read anything from the input.
In short, your task is to simulate multiplication by using only comparison and addition . There is no input in this problem, you just print a sequence of operations.
Imagine that there is a big array of length . The first two values are initially two non-negative integers and (which are unknown to you), the other elements are zeros. Your goal is to get the product in at the end.
You are allowed operations of two types, with the following format (where ):
+ i j k
— applies operation .< i j k
— applies operation . That is, if then becomes , otherwise it becomes .
You can use at most operations. Elements of can't exceed . Indices don't have to be distinct. It's allowed to modify any element of the array (including the first two). The actual checker simulates the process for multiple pairs within a single test. Each time, the checker chooses values and , creates the array , applies all your operations and ensures that .
Constraints
Partial Score
- points will be awarded for passing tests that satisfy .
- Another points will be awarded for passing all tests.
Input
The Standard Input is empty.
Output
In the first line, print the number of operations.
Each operation should then be printed in a single line of format + i j k
or < i j k
.
4
< 0 1 8
+ 0 1 2
+ 2 8 2
+ 0 0 0
In the first sample test, the checker checks your sequence only for a pair . The provided output is correct for this test:
- Initially, , , .
< 0 1 8
applies because .+ 0 1 2
applies .+ 2 8 2
applies .+ 0 0 0
applies .- As required, at the end we have .