Submission #1798166
Source Code Expand
#include <bits/stdc++.h> using namespace std; using ll = long long int; using ld = long double; const int INF = 1 << 29; const ll LINF = 1l << 61; const ld PI = abs(acos(-1)); #define pq priotity_queue #define mp make_pair #define P pair #define rep(i, a, b) for (ll i = a; i < b; i++) #define rrep(i, a, b) for (ll i = a; i >= b; i--) #define cbuf(buf, init) memset(buf, init, sizeof(buf)) #define modp(x, y) (((y) + (x) % (y)) % (y)) #define divd(x, y) (static_cast<double>(x) / static_cast<double>(y)) const ll MOD = 1'000'000'007; ll K, N; ll S[2000000]; int main() { // cin >> N >> K; S[0] = 1; rep(i, 0, N) { S[i + 1] = modp(S[i] * 2, MOD); ll j = i - K; if (j == -2) S[i + 1] -= modp(1, MOD); else if (j >= 0) S[i + 1] -= modp(S[j], MOD); S[i + 1] = modp(S[i + 1], MOD); } cout << S[N - 1] - S[N - 2] << endl; }
Submission Info
Submission Time | |
---|---|
Task | F - 準急 |
User | u_anqou |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 952 Byte |
Status | WA |
Exec Time | 16 ms |
Memory | 8448 KB |
Judge Result
Set Name | All | ||||
---|---|---|---|---|---|
Score / Max Score | 0 / 4 | ||||
Status |
|
Set Name | Test Cases |
---|---|
All | 00, 01, 02, 03, 04, 90, 91 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00 | AC | 16 ms | 8448 KB |
01 | WA | 15 ms | 8448 KB |
02 | AC | 8 ms | 4352 KB |
03 | WA | 7 ms | 4352 KB |
04 | WA | 15 ms | 8448 KB |
90 | AC | 1 ms | 256 KB |
91 | AC | 1 ms | 256 KB |