Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma warning (disable : 4996)
- #pragma comment(linker, "/STACK:36777216")
- #include <stdlib.h>
- #include <iostream>
- #include <vector>
- #include <string>
- #include <assert.h>
- #include <stack>
- #include <algorithm>
- #include <ios>
- #include <iostream>
- #include <fstream>
- #include <iomanip>
- #include <queue>
- #include <set>
- #include <functional>
- #include <cmath>
- #include <sstream>
- #include <map>
- #include <memory.h>
- #include <stdio.h>
- #include <cassert>
- #include <string.h>
- #include <deque>
- #include <ctime>
- #include <list>
- #include <unordered_set>
- #include <unordered_map>
- #define forn(i , n) for (int i = 0; i < n; ++i)
- #define down(i, n) for (int i = (n) - 1; i >= 0; --i)
- using namespace std;
- typedef unsigned long long int u64;
- typedef long long int i64;
- typedef vector<int> vint;
- typedef vector<i64> vi64;
- typedef pair<int, int> pint;
- typedef pair<i64, i64> pi64;
- #define FILE_NAME "file"
- #define CONTEST "kids"
- #define M_PI 3.14159265358979323846
- #define ALL(a) (a).begin(), (a).end()
- #define mp make_pair
- typedef long long ll;
- typedef long double ld;
- const ld EPS = 1e-9;
- const int N = 10000001;
- const i64 INF = 1E8;
- const i64 MOD = 1000000007;
- char invert(char c)
- {
- if (c == '0')
- return '1';
- return '0';
- }
- int counter = 500;
- int main()
- {
- //#ifdef FILE_INPUT
- // freopen(FILE_NAME ".in", "r", stdin);
- // freopen(FILE_NAME ".out", "w", stdout);
- //#else
- // freopen(CONTEST ".in", "r", stdin);
- // freopen(CONTEST ".out", "w", stdout);
- //#endif
- srand(5);
- int n;
- cin >> n;
- counter += n;
- string s;
- forn(i, n)
- {
- s += '0' + rand() % 2;
- }
- int res = 0;
- int pos = 0;
- while (res != n / 2)
- {
- cout << s << endl;
- --counter;
- cin >> res;
- if (res == n)
- {
- return 0;
- }
- if (res != n / 2)
- {
- s[pos] = invert(s[pos]);
- ++pos;
- }
- }
- vint arr(n);
- for (int i = 1; i < n; ++i)
- {
- string c = s;
- c[0] = invert(c[0]);
- c[i] = invert(c[i]);
- cout << c << endl;
- cin >> res;
- if (res == n)
- {
- return 0;
- }
- if (res == n / 2)
- {
- arr[i] = 1;
- }
- }
- forn(i, n)
- {
- if (arr[i])
- {
- s[i] = invert(s[i]);
- }
- }
- cout << s << endl;
- cin >> res;
- if (res == n)
- return 0;
- forn(i, n)
- {
- s[i] = invert(s[i]);
- }
- cout << s << endl;
- cin >> res;
- if (res == n)
- return 0;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement