潍坊做网站软件,crm客户管理系统开发,做阀门网站,网站流量指标有哪些CF1365G Secure Password
Solution
妙妙思维题。
注意到(136)n\binom{13}{6}n(613)n。#xff08;谁tm能注意到这个#xff1f;#xff01;#xff1f;#xff09;
我们可以把所有13位二进制数中有6个1的拿出来给nnn个数重标号。然后对于每一位iii…CF1365G Secure Password
Solution
妙妙思维题。
注意到(136)n\binom{13}{6}n(613)n。谁tm能注意到这个
我们可以把所有13位二进制数中有6个1的拿出来给nnn个数重标号。然后对于每一位iii求出重标号后这一位是1的数的位或和记为wiw_iwi。
对于重标号后为iii的位置的答案只需要让所有iii的0的位的wjw_jwj或起来即可。
Code
#include bits/stdc.husing namespace std;templatetypename T inline bool upmin(T x, T y) { return y x ? x y, 1 : 0; }
templatetypename T inline bool upmax(T x, T y) { return x y ? x y, 1 : 0; }#define MP(A,B) make_pair(A,B)
#define PB(A) push_back(A)
#define SIZE(A) ((int)A.size())
#define LEN(A) ((int)A.length())
#define FOR(i,a,b) for(int i(a);i(b);i)
#define fi first
#define se secondtypedef long long ll;
typedef unsigned long long ull;
typedef long double lod;
typedef pairint, int PR;
typedef vectorint VI; const lod eps 1e-9;
const lod pi acos(-1);
const int oo 1 30;
const ll loo 1ll 60;
const int mods 1e9 7;
const int inv2 (mods 1) 1;
const int MAXN 1005;
const int INF 0x3f3f3f3f; //1061109567
/*--------------------------------------------------------------------*/ll a[5005], w[15], num 0;
vectorll V;
signed main() {
#ifndef ONLINE_JUDGE
// freopen(a.in, r, stdin);
#endifint n;cin n;for (int i 0; i 1 13 num n ; i)if (__builtin_popcount(i) 6) a[ num] i;for (int i 0; i 13 ; i) {vectorint V; V.clear();for (int j 1; j n ; j)if ((a[j] i) 1) V.PB(j);if (!V.size()) continue;cout ? V.size();for (auto v : V) cout v; cout endl;cin w[i];}cout !;for (int i 1; i n ; i) {ll ans 0;for (int j 0; j 13 ; j)if (!((a[i] j) 1)) ans | w[j];cout ans;}return 0;
}