Submission #604738

#TimeUsernameProblemLanguageResultExecution timeMemory
604738ACGNKangaroo (CEOI16_kangaroo)C++17
6 / 100
2069 ms212 KiB
#pragma GCC optimize("O3") #include<algorithm> #include<iostream> using namespace std; int main() { //freopen("kangaroo.in","r",stdin); //freopen("kangaroo.out","w",stdout); int n,cs,cf; cin>>n>>cs>>cf; int R[n];for (int i=0;i<n;i++) R[i]=i+1; int M=0; do { if ((R[0]==cs)&&(R[n-1]==cf)) { int sm = 1; for (int i=0;i<n-2;i++) { if ((R[i]-R[i+1])*(R[i+1]-R[i+2])>0) sm=0; } M+=sm; } } while (next_permutation(R,R+n)); cout<<M<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...