Submission #19821

#TimeUsernameProblemLanguageResultExecution timeMemory
19821xhae동전 (kriii4_E)C++14
0 / 100
2 ms2748 KiB
#include <math.h> #include <stdio.h> #include <string.h> #include <vector> #include <string> #include <queue> #include <map> #include <algorithm> #include <cmath> #include <iostream> #include <sstream> #include <set> using namespace std; const int mmod = 1000000007; int prv[256][512]; // successive previous H, current grundy int nxt[256][512]; int main() { int n; cin >> n; vector<int> grundy(1); grundy[0] = 0; for (int i=1; i<=n; i++) { set<int> nxt; for (int remain=0; remain<=i; remain++) for (int i=0; i<=remain; i++) nxt.insert(grundy[i] ^ grundy[remain - i]); int ii = 0; while (nxt.find(ii) != nxt.end()) ii ++; grundy.push_back(ii); } // for (int i=0; i<=n; i++) printf("%d ", grundy[i]); // printf("\n"); prv[0][0] = 1; for (int i=0; i<=n; i++) { for (int j=0; j<=i; j++) for (int k=0; k<512; k++) { if (i < n) { // H nxt[j+1][k] = (nxt[j+1][k] + prv[j][k]) % mmod; } { // T nxt[0][k^grundy[j]] = (nxt[0][k^grundy[j]] + prv[j][k]) % mmod; } } for (int j=0; j<256; j++) for (int k=0; k<512; k++) prv[j][k] = nxt[j][k], nxt[j][k] = 0; } printf("%d\n", prv[0][0]); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...