CSES - Putka Open 2020 – 2/5 - Results
Submission details
Task:Torni
Sender:hltk
Submission time:2020-09-26 16:03:56 +0300
Language:C++ (C++17)
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED15
#2ACCEPTED41
#3ACCEPTED44
Test results
testverdicttimegroup
#1ACCEPTED0.02 s1, 2, 3details
#2ACCEPTED0.02 s2, 3details
#3ACCEPTED0.02 s3details

Code

#include <iostream>
constexpr long long mod = 1000000007;
constexpr int max = 1000001;
int z[max];
int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	z[1] = 2;
	z[2] = 8;
	for (int i = 3; i < max; ++i)
		z[i] = ((6ll * z[i - 1] - 7ll * z[i - 2]) % mod + mod) % mod;
	int t;
	std::cin >> t;
	while (t--) {
		int n;
		std::cin >> n;
		std::cout << z[n] << '\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: 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