# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
466170 | ardaak33 | Rack (eJOI19_rack) | C++17 | 1084 ms | 204 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
long long int kuvvet[1000005];
long long int mod = 1e9 + 7;
long long int sayac=1;
vector <long long int> us;
bool bayrak=false;
long long int usal(int us){
long long int temp;
if(kuvvet[us]!=0)
return kuvvet[us];
if(kuvvet[us/2]!=0)
temp=kuvvet[us/2];
else
temp=usal(us/2);
if(us%2){
kuvvet[us]= (((temp*temp)%mod)*2)%mod;
return kuvvet[us];
}
else{
kuvvet[us]=((temp*temp)%mod);
return kuvvet[us];
}
}
void yap(int n,int k,int sinir) {
if(sayac==k){
bayrak=true;
return;
}
for (int i = n; i > sinir; i--)
{
sayac++;
yap(n,k,i);
if(bayrak==true){
//cout << i<<endl;
us.push_back(i-1);
return;
}
}
}
int main() {
cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false);
long long int n,k;
cin >> n >> k;
yap(n,k,0);
long long int sonuc=0;
kuvvet[0]=1;
kuvvet[1]=2;
for (int i = 0; i < us.size(); i++)
{
sonuc+=usal(us[i]);
sonuc%=mod;
}
cout << (sonuc+1)%mod;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |