using ll=longlong; using ull=unsignedlonglong; using pii=pair<int,int>; #define begend(x) x.begin(),x.end() #define mem0(x) memset(x,0,sizeof(x)) #define YES puts("Yes") #define NO puts("No")
intread(){ int f=1,x=0;char c=getchar(); while(!isdigit(c)){if(c=='-')f=-1;c=getchar();} while(isdigit(c)){x=x*10+c-'0';c=getchar();} return x*f; }
int a[200];
intmain(){ int n=read(),p=read(),q=read(); for(int i=0;i<n;i++){ a[i]=read(); } printf("%d\n",min(p,q+*min_element(a,a+n))); return0; }
using ll=longlong; using ull=unsignedlonglong; using pii=pair<int,int>; #define begend(x) x.begin(),x.end() #define mem0(x) memset(x,0,sizeof(x)) #define YES puts("Yes") #define NO puts("No")
intread(){ int f=1,x=0;char c=getchar(); while(!isdigit(c)){if(c=='-')f=-1;c=getchar();} while(isdigit(c)){x=x*10+c-'0';c=getchar();} return x*f; }
structProduct{ int p; bool func[105]; }a[105];
intmain(){ int n=read(),m=read(); for(int i=0;i<n;i++){ a[i].p=read(); int k=read(); while(k--){ a[i].func[read()]=1; } }
bool ans = 0; for(int i=0;i<n;i++){ for(int j=i+1;j<n;j++){ int ii=i,jj=j; // ii 比较便宜,p_ii <= p_jj if(a[ii].p>a[jj].p)swap(ii,jj); // 满足了条件 1
bool flag = 1; // ii 是否有 jj 所有的功能 bool extra = 0; // ii 是否有 jj 没有的功能 for(int k=1;k<=m;k++){ if(!a[ii].func[k] && a[jj].func[k]){ flag = 0; } if(a[ii].func[k] && !a[jj].func[k]){ extra=1; } }
using ll=longlong; using ull=unsignedlonglong; using pii=pair<int,int>; #define begend(x) x.begin(),x.end() #define mem0(x) memset(x,0,sizeof(x)) #define YES puts("Yes") #define NO puts("No")
intread(){ int f=1,x=0;char c=getchar(); while(!isdigit(c)){if(c=='-')f=-1;c=getchar();} while(isdigit(c)){x=x*10+c-'0';c=getchar();} return x*f; }
set<string> vis; int ans = 0; intmain(){ int n=read(); for(int i=0;i<n;i++){ string x;cin>>x; if(!vis.count(x)){ ans++; vis.insert(x); reverse(x.begin(),x.end()); vis.insert(x); } }
printf("%d\n",ans); return0; }
D. Peaceful Teams
题意
有 N 个人,M 组敌人,敌人不能分在一个队里面。
请问:把 N 个人分进 T 个队,有几种不同的方案?我们称两个方案为不同的,当且仅当存在两个人在一个方案分在同队,在另一个方案分在不同队伍。
using ll=longlong; using ull=unsignedlonglong; using pii=pair<int,int>; #define begend(x) x.begin(),x.end() #define mem0(x) memset(x,0,sizeof(x)) #define YES puts("Yes") #define NO puts("No")
intread(){ int f=1,x=0;char c=getchar(); while(!isdigit(c)){if(c=='-')f=-1;c=getchar();} while(isdigit(c)){x=x*10+c-'0';c=getchar();} return x*f; }
using ll=longlong; using ull=unsignedlonglong; using pii=pair<int,int>; #define begend(x) x.begin(),x.end() #define mem0(x) memset(x,0,sizeof(x)) #define YES puts("Yes") #define NO puts("No")
intread(){ int f=1,x=0;char c=getchar(); while(!isdigit(c)){if(c=='-')f=-1;c=getchar();} while(isdigit(c)){x=x*10+c-'0';c=getchar();} return x*f; }
using ll=longlong; using ull=unsignedlonglong; using pii=pair<int,int>; #define begend(x) x.begin(),x.end() #define mem0(x) memset(x,0,sizeof(x)) #define YES puts("Yes") #define NO puts("No")
intread(){ int f=1,x=0;char c=getchar(); while(!isdigit(c)){if(c=='-')f=-1;c=getchar();} while(isdigit(c)){x=x*10+c-'0';c=getchar();} return x*f; }
constint MOD = 998244353; constint N = 105; int a[N];