This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <functional>
#include <vector>
#include <numeric>
#include <deque>
#include <utility>
#include <bitset>
#include <iostream>
using namespace std;
typedef long long lint;
typedef long double llf;
typedef pair<int, int> pi;
const int mod = 1e9 + 7;
int dp[255][256];
int f(int x, int y){
if(x == 0) return y == 0;
if(~dp[x][y]) return dp[x][y];
int ret = f(x-1, y);
for(int i=1; i<x; i++){
ret += f(x-i - 1, y ^ i);
ret %= mod;
}
return dp[x][y] = ret;
}
int main(){
memset(dp, -1, sizeof(dp));
int n; cin >> n;
cout << f(n+1, 0);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |