mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-23 18:48:48 +00:00
#1970. 【Public NOIP Round #5】青鱼和序列
https://sjzezoj.com/submission/72550
This commit is contained in:
parent
acbf73ce31
commit
ded1af697d
56
S2OJ/1970/1970.cpp
Normal file
56
S2OJ/1970/1970.cpp
Normal file
@ -0,0 +1,56 @@
|
||||
#include <iostream>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
const int N = 1e5 + 5;
|
||||
const int mod = 1e9 + 7;
|
||||
|
||||
int n, m, a[N], b[N];
|
||||
long long ans1, ans2, ans3;
|
||||
|
||||
long long binpow(long long a, long long b, long long mod = ::mod) {
|
||||
a %= mod;
|
||||
|
||||
long long res = 1;
|
||||
|
||||
while (b) {
|
||||
if (b & 1) res = res * a % mod;
|
||||
a = a * a % mod;
|
||||
b >>= 1;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
cin >> n >> m;
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
cin >> a[i];
|
||||
|
||||
b[n - i + 1] = a[i];
|
||||
}
|
||||
|
||||
long long x = binpow(2, m - 1);
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
ans1 = (((ans1 + static_cast<long long>(a[i]) * ((static_cast<long long>(x + 1) * n - i + 1) % mod + mod % mod) % mod * x) % mod) + mod) % mod;
|
||||
}
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
ans2 = (((ans2 + static_cast<long long>(b[i]) * ((static_cast<long long>(x + 1) * n - i + 1) % mod + mod % mod) % mod * x) % mod) + mod) % mod;
|
||||
}
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
ans3 = (((ans3 + static_cast<long long>(a[i]) * ((static_cast<long long>(x) * n - i + 1) % mod + mod % mod) % mod * x) % mod) + mod) % mod;
|
||||
}
|
||||
|
||||
cout << std::max(((ans1 + ans3) % mod + mod) % mod, ((ans2 + ans3) % mod + mod) % mod) << endl;
|
||||
|
||||
return 0;
|
||||
}
|
BIN
S2OJ/1970/data/problem.conf
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/problem.conf
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq1.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq1.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq10.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq10.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq10.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq11.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq11.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq11.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq11.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq12.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq12.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq12.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq12.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq13.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq13.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq13.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq13.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq14.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq14.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq14.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq14.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq15.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq15.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq15.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq15.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq16.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq16.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq16.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq16.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq17.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq17.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq17.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq17.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq18.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq18.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq18.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq18.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq19.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq19.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq19.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq19.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq2.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq2.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq20.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq20.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq20.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq20.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq21.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq21.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq21.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq21.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq22.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq22.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq22.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq22.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq23.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq23.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq23.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq23.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq24.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq24.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq24.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq24.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq25.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq25.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq25.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq25.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq26.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq26.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq26.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq26.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq27.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq27.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq27.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq27.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq28.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq28.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq28.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq28.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq29.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq29.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq29.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq29.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq3.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq3.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq3.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq30.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq30.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq30.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq30.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq31.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq31.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq31.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq31.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq32.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq32.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq32.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq32.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq4.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq4.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq4.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq5.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq5.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq5.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq6.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq6.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq6.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq7.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq7.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq7.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq8.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq8.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq8.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq9.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq9.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq9.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/std.cpp
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/std.cpp
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/val.cpp
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/val.cpp
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user