oj mrJudge
Toggle navigation
  • Login
    • Forget Password
      Login
User Image

Hello, Stranger

Guest
  • Analysis Mode
  • Problems
    • All Problems
    • Latest Problems
  • Join Us Now
  • Registration
  • Contact Us
  • Infomation
  • About
    • Terms of Use
    • Technical Specifications
    • Credits

nis Batch , stdin/stdout

Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

nis.html

Problem Description

Given a sequence A of N integers, find the number of strictly increasing subsequences, modulo 109 + 7.

Input

The first line of input will contain a single integer, N.

The second line of input will contain N integers, representing the sequence A.

Output

The output should contain one line with one integer, the number of strictly increasing subsequences, modulo 109 + 7.

Limits

Subtask 1 (30%): 1 ≤ N ≤ 103, 1 ≤ Ai ≤ 103.

Subtask 2 (10%): 1 ≤ N ≤ 106, Ai = i + 1. (A will be 1...N)

Subtask 3 (24%): 1 ≤ N ≤ 106, 1 ≤ Ai ≤ 106.

Subtask 4 (36%): 1 ≤ N ≤ 106, 1 ≤ Ai ≤ 109.

Subtask 5 (0%): Sample Testcases.

Sample Input 1

4
1 2 3 4

Sample Output 1

15

Sample Input 2

5
1 6 2 4 3

Sample Output 2

13

Tags

Dynamic Programming, Data Structure

Subtasks and Limits

Subtask Score #TC Time Memory Scoring
130221.5s256MBMinimum
210211.5s256MBMinimum
324421.5s256MBMinimum
436821.5s256MBMinimum
5021.5s256MBMinimum

Judge Compile Command

g++-8 ans.cpp -o nis -Wall -Wshadow -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512

Accepted Submissions

subIDUserTimeMax Time

Past Submissions

subIDUserTimeScore
mrJudge 09.05.20
Copyright © 2020 mrJudge. All rights reserved.