No tags yet

No tag edit access

The problem statement has recently been changed. View the changes.

×
Time limit per test: 1 second(s)

Memory limit: 4096 kilobytes

Memory limit: 4096 kilobytes

input: standard

output: standard

output: standard

You are given a sequence of signed 64-bit integers defined as follows:

*x*_{0}= 1,- ,

modis a remainder operator. All arithmetic operations are evaluated without overflow checking. Use standard "remainder" operator for programming languages (it differs from the mathematical version; for example in programming, while in mathematics). Use "

long long" type in C++, "

long" in Java and "

int64" in Delphi to store

Let's call a sequence element

Given

sample input | sample output |

2 2 9 | 4 |

sample input | sample output |

2305843009213693951 1 9223372036854775807 | 5 |

sample input | sample output |

-2 1 5 | 4 |

In the second sample test the sequence starts with the following numbers: 1, 2305843009213693951, -4611686018427387903, 6917529027641081855, 0, 0, 0. The first repeatable element is 0. The second occurence of 0 has index 5.

In the third sample test the sequence starts with the following numbers: 1, -2, 4, -3, 1, -2, 4. The first repeatable element is 1. The second occurence of 1 has index 4.

Codeforces (c) Copyright 2010-2021 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: May/13/2021 00:52:07 (j1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|