Submission #466169

# Submission time Handle Problem Language Result Execution time Memory
466169 2021-08-18T09:06:38 Z ardaak33 Rack (eJOI19_rack) C++17
40 / 100
1000 ms 204 KB
#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){
if(kuvvet[us]!=0)
return kuvvet[us];

long long int temp=usal(us/2);
if(us%2)
return (((temp*temp)%mod)*2)%mod;
else
return ((temp*temp)%mod);


}


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

rack.cpp: In function 'int main()':
rack.cpp:53:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 | for (int i = 0; i < us.size(); i++)
      |                 ~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 2 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 2 ms 204 KB Output is correct
11 Execution timed out 1093 ms 204 KB Time limit exceeded
12 Halted 0 ms 0 KB -