Task: | Torni |
Sender: | Sisuaski |
Submission time: | 2020-09-26 16:29:29 +0300 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 15 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 15 |
#2 | WRONG ANSWER | 0 |
#3 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.02 s | 1, 2, 3 | details |
#2 | WRONG ANSWER | 0.02 s | 2, 3 | details |
#3 | WRONG ANSWER | 0.02 s | 3 | details |
Code
#include <iostream> using namespace std; const int Z = 1e9+7; const int MN = 1<<20; long long A[MN], B[MN]; int main() { A[0]=B[0]=1; for(int i=1; i<MN; ++i) { A[i] = (4*A[i-1] + B[i-1])%Z; B[i] = (A[i-1] + 2*B[i-1])%Z; } int t;cin>>t; while(t--){ int n;cin>>n; cout<<A[n-1]+B[n-1]<<'\n'; } }
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: WRONG ANSWER
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: WRONG ANSWER
input |
---|
100 996306 650655 896240 821967 ... |
correct output |
---|
87350005 606189151 122595036 193572715 227926807 ... |
user output |
---|
1087350012 606189151 1122595043 1193572722 1227926814 ... Truncated |