mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-24 03:31:59 +00:00
#1807. 【2017.3 长乐省选集训 Day7 T3】石子游戏
https://sjzezoj.com/submission/66132
This commit is contained in:
parent
5305fbc8e8
commit
15d78f166d
62
S2OJ/1807/1807.cpp
Normal file
62
S2OJ/1807/1807.cpp
Normal file
@ -0,0 +1,62 @@
|
||||
#include <iostream>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
const int N = (1 << 16) + 5;
|
||||
|
||||
int t, k, a[17][N];
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
cin >> t;
|
||||
|
||||
while (t--) {
|
||||
int ans = 0, sum = 0;
|
||||
|
||||
cin >> k;
|
||||
|
||||
for (int i = 0; i < k; i++) {
|
||||
for (int j = 0; j < 1 << i; j++) {
|
||||
cin >> a[i][j];
|
||||
|
||||
if ((i + k) % 2) {
|
||||
sum ^= a[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < k; i++) {
|
||||
for (int j = 0; j < 1 << i; j++) {
|
||||
if ((i + k) % 2) {
|
||||
sum ^= a[i][j];
|
||||
|
||||
if (sum <= a[i][j]) {
|
||||
ans += 1 + (i != k - 1);
|
||||
}
|
||||
|
||||
sum ^= a[i][j];
|
||||
} else {
|
||||
sum ^= a[i + 1][j << 1];
|
||||
|
||||
if (a[i + 1][j << 1] <= sum && sum <= a[i + 1][j << 1] + a[i][j]) ans++;
|
||||
|
||||
sum ^= a[i + 1][j << 1];
|
||||
|
||||
sum ^= a[i + 1][j << 1 | 1];
|
||||
|
||||
if (a[i + 1][j << 1 | 1] <= sum && sum <= a[i + 1][j << 1 | 1] + a[i][j]) ans++;
|
||||
|
||||
sum ^= a[i + 1][j << 1 | 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cout << (sum ? ans : 0) << endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
BIN
S2OJ/1807/data/problem.conf
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/problem.conf
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone1.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone1.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone10.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone10.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone10.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone11.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone11.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone11.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone11.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone12.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone12.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone12.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone12.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone13.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone13.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone13.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone13.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone14.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone14.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone14.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone14.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone15.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone15.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone15.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone15.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone16.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone16.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone16.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone16.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone17.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone17.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone17.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone17.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone18.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone18.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone18.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone18.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone19.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone19.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone19.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone19.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone2.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone2.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone20.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone20.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone20.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone20.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone3.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone3.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone3.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone4.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone4.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone4.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone5.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone5.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone5.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone6.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone6.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone6.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone7.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone7.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone7.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone8.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone8.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone8.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone9.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone9.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1807/data/stone9.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1807/data/stone9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user