Submission #00015
ソースコード
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 | #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[105], b[105]; ll x = 0; cin >> n; for ( int i = 0; i < n; i++) { cin >> w[i] >> b[i]; x ^= grundy(w[i], b[i]); } if (x != 0) { cout << 0 << endl; } else { cout << 1 << endl; } } |
ステータス
項目 | データ |
---|---|
問題 | 0010 - 石遊び |
ユーザー名 | ARUMAKAN |
投稿日時 | 2019-10-23 17:47:37 |
言語 | C++14 |
状態 | Wrong Answer |
得点 | 0 |
ソースコード長 | 957 Byte |
最大実行時間 | 157 ms |
最大メモリ使用量 | 968 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 0 / 12 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
in01.txt | AC | 48 ms | 860 KB |
1
|
in02.txt | AC | 40 ms | 712 KB |
1
|
in03.txt | AC | 43 ms | 820 KB |
1
|
in04.txt | WA | 41 ms | 672 KB |
1
|
in05.txt | WA | 41 ms | 652 KB |
1
|
in06.txt | AC | 39 ms | 888 KB |
1
|
in07.txt | AC | 44 ms | 740 KB |
1
|
in08.txt | AC | 43 ms | 720 KB |
1
|
in09.txt | AC | 42 ms | 832 KB |
1
|
in10.txt | AC | 42 ms | 808 KB |
1
|
in11.txt | AC | 45 ms | 788 KB |
1
|
in12.txt | AC | 44 ms | 896 KB |
1
|
in13.txt | AC | 45 ms | 748 KB |
1
|
in14.txt | AC | 44 ms | 728 KB |
1
|
in15.txt | RE | 157 ms | 968 KB |
1
|
in16.txt | RE | 64 ms | 944 KB |
1
|
in17.txt | RE | 50 ms | 920 KB |
1
|
in18.txt | RE | 56 ms | 776 KB |
1
|
in19.txt | RE | 49 ms | 764 KB |
1
|
in20.txt | RE | 54 ms | 868 KB |
1
|
in21.txt | RE | 53 ms | 728 KB |
1
|
in22.txt | RE | 52 ms | 836 KB |
1
|
in23.txt | RE | 48 ms | 816 KB |
1
|
in24.txt | RE | 52 ms | 800 KB |
1
|
in25.txt | RE | 59 ms | 784 KB |
1
|
in26.txt | RE | 50 ms | 760 KB |
1
|
in27.txt | RE | 52 ms | 744 KB |
1
|
in28.txt | RE | 55 ms | 728 KB |
1
|
in29.txt | RE | 51 ms | 840 KB |
1
|
in30.txt | RE | 57 ms | 828 KB |
1
|
in31.txt | RE | 50 ms | 816 KB |
1
|
in32.txt | RE | 51 ms | 928 KB |
1
|
in33.txt | RE | 49 ms | 776 KB |
1
|
in34.txt | RE | 54 ms | 760 KB |
1
|
in35.txt | RE | 49 ms | 868 KB |
1
|
in36.txt | RE | 53 ms | 724 KB |
1
|
in37.txt | RE | 51 ms | 832 KB |
1
|
in38.txt | RE | 54 ms | 820 KB |
1
|
in39.txt | RE | 56 ms | 680 KB |
1
|
in40.txt | RE | 57 ms | 796 KB |
1
|
in41.txt | AC | 46 ms | 776 KB |
1
|
in42.txt | AC | 44 ms | 752 KB |
1
|