Submission #00016


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <iostream>
#include <set>
using namespace std;
using ll = long long;
ll grundy_mem[105][105];
ll grundy(ll w, ll b) {
if (grundy_mem[w][b] != -1) return grundy_mem[w][b];
set<ll> s;
for (int i = 1; i <= w; i++) {
if (b - i >= 0) {
s.insert(grundy(w, b - i));
}
}
if (w - 1 >= 0) {
s.insert(grundy(w - 1, b));
}
if (b - 1 >= 0) {
s.insert(grundy(w + 1, b - 1));
}
ll g = 0;
while (s.find(g) != s.end()) g++;
return grundy_mem[w][b] = g;
}
int main() {
for (int i = 0; i <= 100; i++) {
for (int j = 0; j <= 100; j++) {
grundy_mem[i][j] = -1;
}
}
for (int i = 0; i <= 100; i++) {
for (int j = 0; j <= 100; j++) {
grundy(i, j);
}
}
ll n;
ll w, b;
ll x = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> w >> b;
x ^= grundy(w, b);
}
if (x != 0) {
cout << 0 << endl;
}
else {
cout << 1 << endl;
}
}

ステータス

項目 データ
問題 0010 - 石遊び
ユーザー名 ARUMAKAN
投稿日時 2019-10-23 17:53:25
言語 C++14
状態 Wrong Answer
得点 0
ソースコード長 938 Byte
最大実行時間 70 ms
最大メモリ使用量 976 KB

セット

セット 得点 Cases
1 ALL 0 / 12 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in01.txt AC 48 ms 860 KB
1
in02.txt AC 42 ms 712 KB
1
in03.txt AC 41 ms 696 KB
1
in04.txt WA 42 ms 676 KB
1
in05.txt WA 47 ms 660 KB
1
in06.txt AC 43 ms 768 KB
1
in07.txt AC 39 ms 872 KB
1
in08.txt AC 47 ms 852 KB
1
in09.txt AC 41 ms 836 KB
1
in10.txt AC 43 ms 812 KB
1
in11.txt AC 36 ms 796 KB
1
in12.txt AC 42 ms 780 KB
1
in13.txt AC 46 ms 764 KB
1
in14.txt AC 47 ms 868 KB
1
in15.txt WA 49 ms 976 KB
1
in16.txt WA 42 ms 836 KB
1
in17.txt WA 48 ms 944 KB
1
in18.txt WA 40 ms 796 KB
1
in19.txt WA 45 ms 772 KB
1
in20.txt WA 51 ms 884 KB
1
in21.txt AC 44 ms 868 KB
1
in22.txt AC 40 ms 852 KB
1
in23.txt AC 43 ms 832 KB
1
in24.txt AC 45 ms 812 KB
1
in25.txt AC 46 ms 792 KB
1
in26.txt AC 44 ms 780 KB
1
in27.txt WA 42 ms 760 KB
1
in28.txt WA 46 ms 744 KB
1
in29.txt WA 45 ms 724 KB
1
in30.txt WA 49 ms 832 KB
1
in31.txt WA 43 ms 816 KB
1
in32.txt WA 44 ms 928 KB
1
in33.txt WA 52 ms 908 KB
1
in34.txt AC 41 ms 892 KB
1
in35.txt AC 53 ms 876 KB
1
in36.txt AC 40 ms 860 KB
1
in37.txt AC 47 ms 840 KB
1
in38.txt AC 42 ms 820 KB
1
in39.txt AC 39 ms 808 KB
1
in40.txt AC 70 ms 792 KB
1
in41.txt AC 46 ms 772 KB
1
in42.txt AC 47 ms 752 KB
1