-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1202_2.cpp
More file actions
38 lines (32 loc) · 760 Bytes
/
Copy path1202_2.cpp
File metadata and controls
38 lines (32 loc) · 760 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*************************************************************************
> File Name: 1202_2.cpp
> Author: dulun
> Mail: dulun@xiyoulinux.org
> Created Time: 2016年03月04日 星期五 12时04分58秒
************************************************************************/
#include<iostream>
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#define LL long long
using namespace std;
LL maxv = 1000000007;
const int N = 100086;
int f[N];
int main()
{
int n;
cin>>n;
int a, ans = 1;
for(int i = 1; i <= n; i++)
{
int t;
scanf("%d", &t);
a = f[t];
f[t] = ans;
ans = (2*ans - a + maxv) % maxv;
}
printf("%lld", (ans - 1 + maxv) % maxv);
return 0;
}