Submission
Status:
PPPPPPPPPP
Score: 100
User: Jibhong
Problemset: Medulla
Language: cpp
Time: 2.077 second
Submitted On: 2024-12-13 20:15:50
#include <bits/stdc++.h>
using namespace std;
#define ll long long
vector <ll> mem (7500010,-1);
ll last=3;
ll func(ll x){
if(mem[x]!=-1)return mem[x];
for(;last<=x;++last){
mem[last] = ((mem[last-3]*mem[last-3]*mem[last-3])+(mem[last-2]*mem[last-1]))%20011;
}
if(last>x)--last;
return mem[x];
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
mem[0]=0;
mem[1]=1;
mem[2]=8;
int n;
cin>>n;
while(n--){
ll inp;
cin>>inp;
cout<<func(inp)<<"\n";
}
return 0;
}