Submission #750070

#TimeUsernameProblemLanguageResultExecution timeMemory
750070anhduc2701콤보 (IOI18_combo)C++17
Compilation error
0 ms0 KiB
/*
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
*/
#include <bits/stdc++.h>
#include "combo.h"
using namespace std;
#define all(x) x.begin(), x.end()
#define len(x) ll(x.size())
#define eb emplace_back
#define PI acos(-1.0)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define MIN(v) *min_element(all(v))
#define MAX(v) *max_element(all(v))
#define BIT(x, i) (1 & ((x) >> (i)))
#define Mpress(x) (1LL << (x))
#define tpress "tnc"
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
typedef long long ll;
typedef long double ld;
const ll INF = 1e18;
const int maxn = 1e6 + 5;
const int mod = 1e9 + 7;
const int mo = 998244353;
using pi = pair<ll, ll>;
using vi = vector<ll>;
using pii = pair<pair<ll, ll>, ll>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
string x[] = {"A", "B", "X", "Y"};
int N;
int press(string d)
{
  int k = press(d);
  return k;
}
string ans;
string guess_sequence(int n)
{
  N = n;
  string d;
  int k = press("AB");
  if (k > 0)
  {
    int d = press("A");
    if (d == 1)
    {
      ans += "A";
    }
    else
    {
      ans += "B";
      swap(x[0], x[1]);
    }
  }
  else
  {
    int d = press("X");
    if (d == 1)
    {
      ans += "X";
      swap(x[0], x[2]);
    }
    else
    {
      ans += "Y";
      swap(x[0], x[3]);
    }
  }
  k = 1;
  while (k + 2 <= n)
  {
    string s = ans;
    s += x[1];
    s += x[1];
    s += ans;
    s += x[1];
    s += x[2];
    s += ans;
    s += x[2];
    s += x[2];
    int p = press(s);
    if (p == k)
    {
      ans += x[3];
      k++;
    }
    else if (p == k + 1)
    {
      s = ans;
      s += x[2];
      s += x[3];
      int d = press(s);
      if (d == k)
      {
        ans += x[1];
        ans += x[3];
        k += 2;
      }
      else if (d == k + 1)
      {
        ans += x[2];
        ans += x[1];
        k += 2;
      }
      else if (d == k + 2)
      {
        ans += x[2];
        ans += x[3];
        k += 2;
      }
    }
    else if (p == k + 2)
    {
      s = ans;
      s += x[1];
      s += x[2];
      int d = press(s);
      if (d == k)
      {
        ans += x[2];
        ans += x[1];
        k += 2;
      }
      else if (d == k + 1)
      {
        ans += x[1];
        ans += x[1];
        k += 2;
      }
      else if (d == k + 2)
      {
        ans += x[1];
        ans += x[2];
        k += 2;
      }
    }
  }
  if (k < n)
  {
    string s = ans + x[0] + ans + x[1];
    int d = press(s);
    if (d == n)
    {
      s = ans + x[0];
      if (press(s) == n)
      {
        return s;
      }
      else
      {
        return ans + x[1];
      }
    }
    else
    {
      s = ans + x[2];
      if (press(s) == n)
      {
        return s;
      }
      else
      {
        return ans + x[3];
      }
    }
  }
  return ans;
}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccHAiYxQ.o: in function `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
grader.cpp:(.text+0x0): multiple definition of `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'; /tmp/ccHwhZQS.o:combo.cpp:(.text+0x100): first defined here
collect2: error: ld returned 1 exit status