Submission #1005053

#TimeUsernameProblemLanguageResultExecution timeMemory
1005053ereringKangaroo (CEOI16_kangaroo)C++17
6 / 100
2086 ms348 KiB
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define pb push_back #define ll long long #define int long long const long long inf=1e18; const int MOD=1e9+7; const int N=41; int n,cs,cf,ans=0; void func(int i,set<int> s,bool flag){ if(s.size()==n && i==cf){ ans++; return; } if(flag){ for(int j=i+1;j<=n;j++){ if(!s.count(j)){ s.insert(j); func(j,s,0); s.erase(j); } } } else{ for(int j=i-1;j>0;j--){ if(!s.count(j)){ s.insert(j); func(j,s,1); s.erase(j); } } } } signed main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin>>n>>cs>>cf; set<int> s; s.insert(cs); func(cs,s,0); func(cs,s,1); cout<<ans; }

Compilation message (stderr)

kangaroo.cpp: In function 'void func(long long int, std::set<long long int>, bool)':
kangaroo.cpp:12:16: warning: comparison of integer expressions of different signedness: 'std::set<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   12 |     if(s.size()==n && i==cf){
      |        ~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...