# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
871038 | Ahmed57 | NoM (RMI21_nom) | C++17 | 1035 ms | 600 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
signed main(){
ios_base::sync_with_stdio(false);cin.tie(0);
int n,k;
cin>>n>>k;
vector<int>v;
for(int i = 0;i<n;i++){
v.push_back(i);v.push_back(i+n);
}
sort(v.begin(),v.end());
long long ans = 0;
do{
int la[n]= {0};bool ss = 1;
for(int i = 0;i<v.size();i++){
if(la[v[i]%n]!=0){
if(abs((i+1)-la[v[i]%n])%k==0){
ss = 0;
break;
}
}
la[v[i]%n] = i+1;
}
if(ss)ans++;
}while(next_permutation(v.begin(),v.end()));
cout<<ans<<endl;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |