Submission #932455

#TimeUsernameProblemLanguageResultExecution timeMemory
932455AiperiiiKangaroo (CEOI16_kangaroo)C++14
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> #define int long long #define ff first #define ss second #define all(x) x.begin(),x.end() #define pb push_back using namespace std; queue <vector <int> > q; int ans=0,n,s,t; void calc(){ while(!q.empty()){ vector <int> v=q.front(); q.pop(); if(v.size()==n){ ans++;continue; } if(v.size()%2==0){ for(int j=v.back();j>=1;j--){ bool ok=1; for(int i=0;i<v.size();i++){ if(j==v[i])ok=0; } v.pb(j); if(ok){ if(v.size()==n)q.push(v); else if(j!=t)q.push(v); } v.pop_back(); } } else{ for(int j=v.back();j<=n;j++){ bool ok=1; for(int i=0;i<v.size();i++){ if(j==v[i])ok=0; } v.pb(j); if(ok){ if(v.size()==n)q.push(v); else if(j!=t)q.push(v); } v.pop_back(); } } } } signed main(){ ios_base::sync_with_stdio(); cin.tie(0);cout.tie(0); cin>>n>>s>>t; q.push({s}); calc(); q.push({t}); calc(); cout<<ans<<"\n"; }

Compilation message (stderr)

kangaroo.cpp: In function 'void calc()':
kangaroo.cpp:14:20: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   14 |         if(v.size()==n){
      |            ~~~~~~~~^~~
kangaroo.cpp:20:30: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |                 for(int i=0;i<v.size();i++){
      |                             ~^~~~~~~~~
kangaroo.cpp:25:32: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   25 |                     if(v.size()==n)q.push(v);
      |                        ~~~~~~~~^~~
kangaroo.cpp:34:30: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |                 for(int i=0;i<v.size();i++){
      |                             ~^~~~~~~~~
kangaroo.cpp:39:32: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   39 |                     if(v.size()==n)q.push(v);
      |                        ~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...