Submission #1117814

#TimeUsernameProblemLanguageResultExecution timeMemory
1117814vjudge1Kangaroo (CEOI16_kangaroo)C++17
0 / 100
1 ms336 KiB
#pragma GCC optimize("O3") #include<bits/stdc++.h> #define ll long long #define endl "\n" #define AI ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); using namespace std; vector<ll>val; vector<vector<ll>>edge; vector<ll>check; ll k,c=0; int main() { AI //freopen("kangaroo.in", "r", stdin); // freopen("kangaroo.out", "w", stdout); ll n,a,b,i,j,per=0; cin>>n>>a>>b; vector<ll>v(n); for(i=1;i<=n;i++) v[i-1]=i; do { if(v[0]!=a or v[n-1]!=b) continue; bool bo=true; for(i=1;i<n;i++) { if(i>2 and ((v[i-2]<v[i-1] and v[i-1]<v[i]) or (v[i-2]>v[i-1] and v[i-1]>v[i]))) { bo=false; break; } } if(bo) per++; }while(next_permutation(v.begin(),v.end())); cout<<per; }

Compilation message (stderr)

kangaroo.cpp: In function 'int main()':
kangaroo.cpp:16:16: warning: unused variable 'j' [-Wunused-variable]
   16 |     ll n,a,b,i,j,per=0;
      |                ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...