Submission #1052091

#TimeUsernameProblemLanguageResultExecution timeMemory
1052091preskoNoM (RMI21_nom)C++14
9 / 100
1006 ms436 KiB
#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)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...