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

singularity Batch , stdin/stdout

Registered Users Only

Please login to utilize this feature.

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

singularity.html

Problem Description

A range of numbers with a gcd (greatest common divisor) of 1 is known as a "singularity" range.

Damian has an array A of N numbers and wonders how many singularity ranges there are.

Can you help him?

Input

The first line contains one integer, N, the number of integers.

The second line contains N space-separated integers, representing the numbers of the array.

Output

The output should contain one line containing one integer, the number of ranges with a gcd of 1.

Limits

For all subtasks, 1 ≤ Ai ≤ 109.

Subtask 1 (13%): 1 ≤ N ≤ 106; Ai = 1.

Subtask 2 (31%): 1 ≤ N ≤ 10 000.

Subtask 3 (56%): 1 ≤ N ≤ 106.

Subtask 4 (0%): Sample Testcases.

Sample Testcase 1

Input

4
2 9 7 14

Output

5

Sample Testcase 1 Explanation

The ranges are {2, 9}, {9, 7}, {2, 9, 7}, {9, 7, 14}, {2, 9, 7, 14}.

Tags

Data Structure

Subtasks and Limits

Subtask Score #TC Time Memory Scoring
113101s256MBMinimum
231111s256MBMinimum
356321s256MBMinimum
4011s256MBMinimum

Judge Compile Command

g++-8 ans.cpp -o singularity -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.