Task: | Torni |
Sender: | ollpu |
Submission time: | 2020-09-25 19:00:01 +0300 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 15 |
#2 | ACCEPTED | 41 |
#3 | ACCEPTED | 44 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.02 s | 1, 2, 3 | details |
#2 | ACCEPTED | 0.02 s | 2, 3 | details |
#3 | ACCEPTED | 0.02 s | 3 | details |
Code
#include <bits/stdc++.h> using namespace std; const int N = 1e6; const int M = 1e9+7; long dp[N+1][2]; int main() { ios::sync_with_stdio(0); cin.tie(0); dp[1][0] = 1; dp[1][1] = 1; for (int i = 2; i <= N; ++i) { dp[i][0] = (2*dp[i-1][0] + dp[i-1][1])%M; dp[i][1] = (dp[i-1][0] + 4*dp[i-1][1])%M; } int T; cin >> T; for (int Ti = 0; Ti < T; ++Ti) { int n; cin >> n; cout << (dp[n][0]+dp[n][1])%M << endl; } }
Test details
Test 1
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
10 1 2 3 4 ... |
correct output |
---|
2 8 34 148 650 ... |
user output |
---|
2 8 34 148 650 ... |
Test 2
Group: 2, 3
Verdict: ACCEPTED
input |
---|
100 1 2 3 4 ... |
correct output |
---|
2 8 34 148 650 ... |
user output |
---|
2 8 34 148 650 ... Truncated |
Test 3
Group: 3
Verdict: ACCEPTED
input |
---|
100 996306 650655 896240 821967 ... |
correct output |
---|
87350005 606189151 122595036 193572715 227926807 ... |
user output |
---|
87350005 606189151 122595036 193572715 227926807 ... Truncated |