Submission #1052091

# Submission time Handle Problem Language Result Execution time Memory
1052091 2024-08-10T11:47:23 Z presko NoM (RMI21_nom) C++14
9 / 100
500 ms 436 KB
#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

Main.cpp: In function 'int main()':
Main.cpp:21:27: warning: 'memset' used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
   21 |         memset(used,0,MAXN);
      |                           ^
# 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 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 50 ms 436 KB Output is correct
10 Correct 71 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 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 50 ms 436 KB Output is correct
10 Correct 71 ms 348 KB Output is correct
11 Execution timed out 1006 ms 344 KB Time limit exceeded
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 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 50 ms 436 KB Output is correct
10 Correct 71 ms 348 KB Output is correct
11 Execution timed out 1006 ms 344 KB Time limit exceeded
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 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 50 ms 436 KB Output is correct
10 Correct 71 ms 348 KB Output is correct
11 Execution timed out 1006 ms 344 KB Time limit exceeded
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 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 50 ms 436 KB Output is correct
10 Correct 71 ms 348 KB Output is correct
11 Execution timed out 1006 ms 344 KB Time limit exceeded
12 Halted 0 ms 0 KB -