Submission #00017
ソースコード
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[205][205]; 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 <= 200; i++) { for ( int j = 0; j <= 200; j++) { grundy_mem[i][j] = -1; } } for ( int i = 0; i <= 200; i++) { for ( int j = 0; j <= 200; 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:58:28 |
言語 | C++14 |
状態 | Accepted |
得点 | 12 |
ソースコード長 | 938 Byte |
最大実行時間 | 211 ms |
最大メモリ使用量 | 1800 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 12 / 12 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
in01.txt | AC | 192 ms | 1500 KB |
1
|
in02.txt | AC | 188 ms | 1532 KB |
1
|
in03.txt | AC | 193 ms | 1308 KB |
1
|
in04.txt | AC | 211 ms | 1340 KB |
1
|
in05.txt | AC | 185 ms | 1372 KB |
1
|
in06.txt | AC | 191 ms | 1404 KB |
1
|
in07.txt | AC | 195 ms | 1436 KB |
1
|
in08.txt | AC | 198 ms | 1464 KB |
1
|
in09.txt | AC | 210 ms | 1492 KB |
1
|
in10.txt | AC | 191 ms | 1520 KB |
1
|
in11.txt | AC | 191 ms | 1428 KB |
1
|
in12.txt | AC | 194 ms | 1588 KB |
1
|
in13.txt | AC | 196 ms | 1620 KB |
1
|
in14.txt | AC | 204 ms | 1648 KB |
1
|
in15.txt | AC | 193 ms | 1684 KB |
1
|
in16.txt | AC | 191 ms | 1716 KB |
1
|
in17.txt | AC | 196 ms | 1624 KB |
1
|
in18.txt | AC | 203 ms | 1528 KB |
1
|
in19.txt | AC | 200 ms | 1436 KB |
1
|
in20.txt | AC | 200 ms | 1468 KB |
1
|
in21.txt | AC | 194 ms | 1496 KB |
1
|
in22.txt | AC | 195 ms | 1528 KB |
1
|
in23.txt | AC | 197 ms | 1560 KB |
1
|
in24.txt | AC | 194 ms | 1588 KB |
1
|
in25.txt | AC | 190 ms | 1620 KB |
1
|
in26.txt | AC | 192 ms | 1656 KB |
1
|
in27.txt | AC | 198 ms | 1556 KB |
1
|
in28.txt | AC | 204 ms | 1592 KB |
1
|
in29.txt | AC | 198 ms | 1752 KB |
1
|
in30.txt | AC | 207 ms | 1656 KB |
1
|
in31.txt | AC | 204 ms | 1556 KB |
1
|
in32.txt | AC | 190 ms | 1464 KB |
1
|
in33.txt | AC | 200 ms | 1620 KB |
1
|
in34.txt | AC | 194 ms | 1520 KB |
1
|
in35.txt | AC | 198 ms | 1420 KB |
1
|
in36.txt | AC | 192 ms | 1452 KB |
1
|
in37.txt | AC | 195 ms | 1612 KB |
1
|
in38.txt | AC | 199 ms | 1640 KB |
1
|
in39.txt | AC | 196 ms | 1800 KB |
1
|
in40.txt | AC | 195 ms | 1708 KB |
1
|
in41.txt | AC | 187 ms | 1612 KB |
1
|
in42.txt | AC | 199 ms | 1644 KB |
1
|