QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#318256#7863. Parity GameNetwork_ErrorCompile Error//C++143.4kb2024-01-30 20:51:382024-01-30 20:51:38

Judging History

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

  • [2024-01-30 20:51:38]
  • 评测
  • [2024-01-30 20:51:38]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair<int, int>
#define piii tuple<int, int, int>
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define deb(var) cerr << #var << '=' << (var) << "; "
#define int long long
namespace IO {
	#define BF 65536
	char buf[BF], *p1 = buf, *p2 = buf;
	#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, BF, stdin), p1 == p2) ? EOF : *p1++)
//	template<typename T>
	inline int uread() {
		int x = 0; char c = getchar();
		while (!isdigit(c)) c = getchar();
		while (isdigit(c)) x = x * 10 + (c ^ 48), c = getchar(); return x;
	}
//	template<typename T>
	inline int read() {
		int x = 0, f = 0; char c = getchar();
		while (!isdigit(c)) f |= c == '-', c = getchar();
		while (isdigit(c)) x = x * 10 + (c ^ 48), c = getchar(); return f ? -x : x;
	}
	char obuf[BF + 30]; int o1, o2, num[30];
	#define flush() fwrite(obuf, 1, o1, stdout), o1 = 0
	inline void putchar(const char &c) {
		obuf[o1++] = c; if (o1 >= BF) flush();
	}
//	template<typename T>
	inline void uwrite(int x) {
		do num[++o2] = x % 10; while (x /= 10);
		do obuf[o1++] = num[o2] ^ 48; while (--o2); obuf[o1++] = '\n'; if (o1 >= BF) flush();
	}
//	template<typename T>
	inline void write(const int& x) {
		if (x < 0) obuf[o1++] = '-', uwrite(-x); else uwrite(x);
	}
} using namespace IO;
namespace Maths {
	const int mod = 998244353;
	int power(int x, int y) {
		int ans = 1; while (y) {
			if (y & 1) ans = 1ll * ans * x % mod; y >>= 1; x = 1ll * x * x % mod;
		} return ans;
	}
	int power(int x, int y, int mod) {
		int ans = 1; while (y) {
			if (y & 1) ans = 1ll * ans * x % mod; y >>= 1; x = 1ll * x * x % mod;
		} return ans;
	}
	int fac[1000010], inv[1000010];
	void init() {
		fac[0] = fac[1] = inv[0] = inv[1] = 1;
		for (int i = 2; i <= 1e6; i++) fac[i] = 1ll * fac[i - 1] * i % mod, inv[i] = 1ll * (mod - mod / i) * inv[mod % i] % mod;
		for (int i = 2; i <= 1e6; i++) inv[i] = 1ll * inv[i] * inv[i - 1] % mod;
	}
	int binom(int n, int m) {
		return n < m || m < 0 ? 0 : 1ll * fac[n] * inv[n - m] % mod * inv[m] % mod;
	}
} using namespace Maths;
namespace Loser {
	int n, t;
	struct List {
		int n, a[510];
		int size() { return n; }
		int& operator [](int k) { return a[k]; }
	} a; 
	List get(List a) {
		int p; char op; cin >> p >> op;
		List c; c.n = a.size() - 1;
		for (int i = 1; i < a.size(); i++) {
			if (i < p) c[i] = a[i];
			else if (i == p) c[i] = op == '+' ? (a[i] + a[i + 1]) % 2 : a[i] * a[i + 1] % 2;
			else c[i] = a[i + 1];
		} return c;
	}
	void main() {
		cin >> n >> t;
		a[i].n = n; for (int i = 1; i <= n; i++) cin >> a[i];
		if (n & 1) {   // bob
			if (t == 1) {
				cout << "Bob" << endl;
				for (int i = 1; i < n; i++) {
					int p; char op;
					if (i & 1) a = get(a);
					else if (i == n - 1) {
						assert(a.size() == 2);
						cout << "1 " << (a[1] && a[2] ? "+" : "*") << endl;
					} else cout << "1 +" << endl;
				}
			}
		} else {   // alice 最后一步 
			if (t == 0) {
				cout << "Alice" << endl;
				for (int i = 1; i < n; i++) {
					int p; char op;
					if (i == n - 1) {
						assert(a.size() == 2);
						cout << "1 " << (a[1] && a[2] ? "+" : "*") << endl;
					} else if (i & 1) cout << "1 +" << endl; else a = get(a);
				}
			}
		}
	}
}
signed main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int T = 1; while (T--) Loser::main(); return 0;
}

详细

answer.code: In function ‘void Loser::main()’:
answer.code:83:19: error: ‘i’ was not declared in this scope
   83 |                 a[i].n = n; for (int i = 1; i <= n; i++) cin >> a[i];
      |                   ^