Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <assert.h>
- #include <bits/stdc++.h>
- using namespace std;
- #ifdef __DEBUG__
- #include "dbg.h"
- #else
- #define dbg(...) 42
- #endif
- template <class T> using mpq = priority_queue<T, vector<T>, greater<T>>;
- using ll = long long;
- using pii = pair<int, int>;
- using pll = pair<ll, ll>;
- using vl = vector<ll>;
- using vi = vector<int>;
- mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
- int get_rdn() { return rng() % int(1e6 + 3); }
- int main(int argc, char **argv)
- {
- int x, m = 0;
- scanf("%d", &m);
- dbg(m);
- for (int i = 0; i < 300; ++i) {
- int roll = get_rdn();
- printf("+ %d\n", roll), fflush(stdout);
- scanf("%d", &x);
- m = max(m, x);
- }
- dbg(m);
- map<int, int> cnt;
- int offset = 0;
- for (int i = 0; i < 340; ++i) {
- printf("+ 1\n"), fflush(stdout);
- scanf("%d", &x);
- if (cnt.count(x)) {
- printf("! %d\n", offset), fflush(stdout);
- return 0;
- }
- cnt[x] = offset++;
- }
- dbg(offset);
- printf("+ %d\n", m - 340), fflush(stdout);
- scanf("%d", &x);
- offset = 0;
- for (int i = 0; i < 340; ++i) {
- printf("+ 340\n"), fflush(stdout);
- scanf("%d", &x);
- if (cnt.count(x)) {
- dbg(offset + m + 339 - cnt[x]);
- printf("! %d\n", offset + m + 339 - cnt[x]), fflush(stdout);
- return 0;
- }
- offset += 340;
- }
- return 0;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement