#include<bits/stdc++.h> using namespace std; int n,k,res; int ans[11],a[11]; set<int> st; void dfs(int x,int cnt) { if(x>n) { return ; } st.clear(); for(int i=1; i<cnt; ++i) { st.insert(a[i]); } if(st.size()==cnt-1) { // for(int i=1;i<cnt;++i){ // cout<<ans[i]<<' '; // } // cout<<'\n'; res=max(res,cnt-1); } ans[cnt]=a[x]; dfs(x+1,cnt+1); dfs(x+1,cnt); } signed main() { cin>>n>>k; for(int i=1; i<=n; ++i) { scanf("%d",&a[i]); } dfs(1,1); cout<<res<<'\n'; return 0; }
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:840 |
用筛法求之N内的素数。 (C语言代码)浏览:802 |
C语言考试练习题_保留字母 (C语言代码)浏览:700 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:632 |
A+B for Input-Output Practice (VII) (C语言代码)浏览:521 |
【偶数求和】 (C语言代码)浏览:430 |
杨辉三角 (C语言代码)浏览:484 |
1052题解(链表操作)浏览:651 |
1197求助浏览:628 |
WU-C语言程序设计教程(第三版)课后习题12.3 (C++代码)浏览:847 |