# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1052091 | presko | NoM (RMI21_nom) | C++14 | 1006 ms | 436 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<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#define MAXN 100
using namespace std;
vector<pair<int,int>> order;
int used[MAXN];
int main()
{
int n,m;
ios_base::sync_with_stdio(false);
cin.tie(0);
cin>>n>>m;
for(int i=1;i<=n;i++)order.push_back({i,0});
for(int i=1;i<=n;i++)order.push_back({i,1});
sort(order.begin(),order.end());
int ans=0;
do
{
memset(used,0,MAXN);
bool fl=1;
for(int i=1;i<=2*n;i++)
{
if(used[order[i-1].first])
{
if((i-used[order[i-1].first])%m==0){fl=0;break;}
}
else used[order[i-1].first]=i;
}
if(fl)ans++;
}while(next_permutation(order.begin(),order.end()));
cout<<ans<<"\n";
}
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... |