Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #include <iomanip>
- #include <iostream>
- #include <random>
- #define pb push_back
- #define mp make_pair
- #define sz size
- #define ll long long
- #define ld long double
- #define fs first
- #define sc second
- #define forn(i, f, t) for(int i = f; i < t; i++)
- #define all(x) (x).begin(), (x).end()
- #define ins insert
- const int INF = 2147483647;
- const int MOD = 1000000007;
- const ll INF64 = 9223372036854775807;
- const ld EPS = 1e-7;
- using namespace std;
- mt19937 gen(1);
- uniform_int_distribution<int> one_bit(0, 1);
- uniform_int_distribution<int> dist(0, INF);
- int const N = 5000;
- int const K = 2000;
- int const X = 100;
- int const L = 25;
- void genSeq(vector<char> &res, int l, int r){
- forn(i, l, r) res[i] = one_bit(gen);
- }
- int req(vector<char> &att){
- forn(i, 0, N) printf("%d", (int)att[i]);
- printf("\n");
- fflush(stdout);
- int res;
- scanf("%d", &res);
- return res - 1;
- }
- int main (void){
- vector<char> atts(N, 0), temp(N, 0);
- map<int, int> right;
- int maxres = 0, lst = 0, cur = N;
- genSeq(atts, 0, N);
- forn(i, 0, L){
- forn(j, 0, X / L){
- genSeq(atts, N / L * i, N / L * (i + 1));
- for (auto it = right.begin(); it != right.end(); it++)
- atts[it->fs] = it->sc;
- cur = req(atts);
- right[cur] = !atts[cur];
- if (right.find(cur + 1) == right.end())
- right[cur + 1] = atts[cur + 1];
- if (cur > maxres){
- temp = atts;
- maxres = cur;
- }
- }
- atts = temp;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement