# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
992531 |
2024-06-04T14:49:48 Z |
Abito |
NoM (RMI21_nom) |
C++17 |
|
50 ms |
452 KB |
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define ppb pop_back
#define ep insert
#define endl '\n'
#define elif else if
#define pow pwr
#define sqrt sqrtt
//#define int long long
#define y1 YONE
typedef unsigned long long ull;
using namespace std;
const int N=20;
int n,m,b[N];
pair<int,int> a[N];
int32_t main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
cin>>n>>m;
for (int i=1;i<=n;i++) a[i]={i,1};
for (int i=1+n;i<=n*2;i++) a[i]={i-n,2};
sort(a+1,a+1+2*n);
int ans=0;
do{
//for (int i=1;i<=2*n;i++) cout<<a[i].F<<' ';
//cout<<endl;
memset(b,0,sizeof(b));
bool ok=true;
for (int i=1;i<=2*n;i++){
if (b[a[i].F]) ok&=((i-b[a[i].F])%m!=0);
else b[a[i].F]=i;
}ans+=ok;
/*if (ok){
for (int i=1;i<=2*n;i++) cout<<a[i].F<<' ';
cout<<endl;
}*/
}while (next_permutation(a+1,a+1+2*n));
cout<<ans<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
48 ms |
348 KB |
Output is correct |
10 |
Correct |
50 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
48 ms |
348 KB |
Output is correct |
10 |
Correct |
50 ms |
348 KB |
Output is correct |
11 |
Runtime error |
1 ms |
452 KB |
Execution killed with signal 11 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
48 ms |
348 KB |
Output is correct |
10 |
Correct |
50 ms |
348 KB |
Output is correct |
11 |
Runtime error |
1 ms |
452 KB |
Execution killed with signal 11 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
48 ms |
348 KB |
Output is correct |
10 |
Correct |
50 ms |
348 KB |
Output is correct |
11 |
Runtime error |
1 ms |
452 KB |
Execution killed with signal 11 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
48 ms |
348 KB |
Output is correct |
10 |
Correct |
50 ms |
348 KB |
Output is correct |
11 |
Runtime error |
1 ms |
452 KB |
Execution killed with signal 11 |
12 |
Halted |
0 ms |
0 KB |
- |