QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#559884#8221. 多方计算Fido_PuppyCompile Error//C++231.5kb2024-09-12 10:12:092024-09-12 10:12:10

Judging History

你现在查看的是最新测评结果

  • [2024-09-12 10:12:10]
  • 评测
  • [2024-09-12 10:12:09]
  • 提交

answer

#include <bits/stdc++.h>
#include "mpc.h"
#define all(x) x.begin(), x.end()
#define pb push_back
#define eb emplace_back
#define rz resize
#define MP make_pair
#define MT make_tuple
#define IT iterator
#define fi first
#define se second
#define For(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define Rep(i, a, b) for (int i = (int)(a); i >= (int)(b); --i)
#define CLR(a, v) memset(a, v, sizeof(a))
#define CPY(a, b) memcpy(a, b, sizeof(a))
#define debug cerr << "ztxakking\n"
#define y0 ztxaknoi
#define y1 ztxakioi
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uint = unsigned int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using vi = vector<int>;
template<typename T>
using V = vector<T>;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
struct player{
  bool last_message;
  array<int, 4096> memory;
};
int precalc(int n, int m);
bool transmit(player &player, int round, int position);
int N, M;
int precalc(int n, int m) {
  N = n, M = m;
  return n + m + 3;
}
bool transmit(player &player, int round, int position) {
  int p = round - position - 1, t = player.last_message;
  if (p < 0) {
    if (p >= -8) p = p + M + 4;
    else p = p + M + 19;
  }
  if (p < 0) return 0;
  int i = p;
  for ( ; player.memory[i]; ++i) player.memory[i] = 0;
  player.memory[i] = 1;
  int u = player.memory[p];
  if (position < N) player.memory[p] = 0;
  return u;
}

Details

answer.code:32:8: error: redefinition of ‘struct player’
   32 | struct player{
      |        ^~~~~~
In file included from answer.code:2:
mpc.h:2:8: note: previous definition of ‘struct player’
    2 | struct player{
      |        ^~~~~~