CF1365G Secure Password(构造,交互,二进制分组)
                                                            生活随笔
收集整理的這篇文章主要介紹了
                                CF1365G Secure Password(构造,交互,二进制分组)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.                        
                                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++.h>using namespace std;template<typename T> inline bool upmin(T &x, T y) { return y < x ? x = y, 1 : 0; } template<typename 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 pair<int, int> PR; typedef vector<int> 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; vector<ll> 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) {vector<int> 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; } 創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的CF1365G Secure Password(构造,交互,二进制分组)的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: 喝啤酒能减肥吗
- 下一篇: CF1375G. Tree Modifi
