Submission #466163

#TimeUsernameProblemLanguageResultExecution timeMemory
466163ardaak33Rack (eJOI19_rack)C++17
40 / 100
1077 ms204 KiB
#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; 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; for (int i = 0; i < us.size(); i++) { for (int j = 0; j<= us[i]; j++) { if(kuvvet[us[i]]!=0){ sonuc+=kuvvet[us[i]]; sonuc%=mod; //cout <<kuvvet[us[i]]; break; } if(kuvvet[j+1]!=0) continue; kuvvet[j+1]=kuvvet[j]*2; kuvvet[j+1]%=mod; //cout << kuvvet[j+1] << endl; } } cout << (sonuc+1)%mod; }

Compilation message (stderr)

rack.cpp: In function 'int main()':
rack.cpp:37:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 | for (int i = 0; i < us.size(); i++)
      |                 ~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...