Task: | Torni |
Sender: | Lieska |
Submission time: | 2020-09-25 18:57:39 +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.06 s | 1, 2, 3 | details |
#2 | ACCEPTED | 0.06 s | 2, 3 | details |
#3 | ACCEPTED | 0.06 s | 3 | details |
Code
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll a[1111000], b[1111000], c[1111000], M=1e9+7; void tapaus(){ int n; cin >> n; cout << a[n] << "\n"; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); a[0]=1; b[0]=1; a[1]=2; b[1]=1; c[1]=1; for (int i=2; i<=1000000; ++i){ b[i]=(b[i-1]+a[i-1])%M; c[i]=(4*c[i-1]+b[i-1])%M; a[i]=(c[i]+b[i])%M; } int t; cin >> t; while (t--) tapaus(); }
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 |