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

Code

#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int t;
	cin >> t;
	vector<int> ns(t);
	int m = 2;
	for (int i = 0; i < t; ++i) {
		cin >> ns[i];
		m = max(m, ns[i]);
	}
	vector<long> s(m);
	s[0] = 2;
	s[1] = 8;
	for (int i = 2; i < m; ++i) {
		s[i] = (6*s[i-1] - 7*s[i-2]) % 1000000007;
		if (s[i] < 0) s[i] += 1000000007;
	}
	for (auto x : ns) {
		cout << s[x-1] << 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