0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-24 03:11:58 +00:00
http://www.nfls.com.cn:20035/submission/591741
This commit is contained in:
Baoshuo Ren 2022-11-18 16:37:33 +08:00
parent 364d5dc01c
commit 63b9b9beec
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
11 changed files with 72 additions and 0 deletions

42
NFLSOJ/0/3632/3632.cpp Normal file
View File

@ -0,0 +1,42 @@
#include <iostream>
#include <fstream>
#include <map>
#include <numeric>
// using std::cin;
// using std::cout;
std::ifstream cin("segment.in");
std::ofstream cout("segment.out");
const char endl = '\n';
const int N = 5e5 + 5;
const int mod = 1e9 + 7;
int n;
long long a[N], s[N], f[N], sum;
std::map<long long, long long> map;
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
std::partial_sum(a + 1, a + 1 + n, s + 1);
f[0] = sum = 1;
for (int i = 1; i <= n; i++) {
f[i] = sum;
sum = ((sum + f[i] - map[s[i]]) % mod + mod) % mod;
map[s[i]] = f[i];
}
cout << f[n] << endl;
return 0;
}

BIN
NFLSOJ/0/3632/samples/segment1.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
NFLSOJ/0/3632/samples/segment1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
NFLSOJ/0/3632/samples/segment2.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
NFLSOJ/0/3632/samples/segment2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
NFLSOJ/0/3632/samples/segment3.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
NFLSOJ/0/3632/samples/segment3.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
NFLSOJ/0/3632/samples/segment4.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
NFLSOJ/0/3632/samples/segment4.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
NFLSOJ/0/3632/samples/segment5.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
NFLSOJ/0/3632/samples/segment5.in (Stored with Git LFS) Normal file

Binary file not shown.