Submission #19795

# Submission time Handle Problem Language Result Execution time Memory
19795 2016-02-25T05:41:45 Z cki86201 동전 (kriii4_E) C++14
100 / 100
64 ms 65224 KB
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>

using namespace std;
typedef long long ll;
typedef pair<int, int> Pi;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()

const ll MOD = 1e9 + 7;

ll pw(ll x, ll y){
	ll res = 1;
	while(y){
		if(y & 1)res = res * x % MOD;
		x = x * x % MOD;
		y >>= 1;
	}
	return res;
}

int d[252][256][252];

int dfs(int r, int bit, int nw){
	if(d[r][bit][nw] != -1)return d[r][bit][nw];
	if(r == 0)return (bit^nw) == 0;
	return d[r][bit][nw] = (dfs(r-1, bit ^ (nw), 0) + dfs(r-1, bit, nw+1)) % MOD;
}

int main(){
	int n;
	scanf("%d", &n);
	memset(d, -1, sizeof d);
	printf("%d", dfs(n, 0, 0));
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 65224 KB Output is correct
2 Correct 4 ms 65224 KB Output is correct
3 Correct 3 ms 65224 KB Output is correct
4 Correct 4 ms 65224 KB Output is correct
5 Correct 4 ms 65224 KB Output is correct
6 Correct 4 ms 65224 KB Output is correct
7 Correct 4 ms 65224 KB Output is correct
8 Correct 3 ms 65224 KB Output is correct
9 Correct 4 ms 65224 KB Output is correct
10 Correct 0 ms 65224 KB Output is correct
11 Correct 7 ms 65224 KB Output is correct
12 Correct 3 ms 65224 KB Output is correct
13 Correct 4 ms 65224 KB Output is correct
14 Correct 10 ms 65224 KB Output is correct
15 Correct 3 ms 65224 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 65224 KB Output is correct
2 Correct 23 ms 65224 KB Output is correct
3 Correct 3 ms 65224 KB Output is correct
4 Correct 0 ms 65224 KB Output is correct
5 Correct 7 ms 65224 KB Output is correct
6 Correct 14 ms 65224 KB Output is correct
7 Correct 33 ms 65224 KB Output is correct
8 Correct 50 ms 65224 KB Output is correct
9 Correct 12 ms 65224 KB Output is correct
10 Correct 47 ms 65224 KB Output is correct
11 Correct 6 ms 65224 KB Output is correct
12 Correct 12 ms 65224 KB Output is correct
13 Correct 47 ms 65224 KB Output is correct
14 Correct 22 ms 65224 KB Output is correct
15 Correct 12 ms 65224 KB Output is correct
16 Correct 4 ms 65224 KB Output is correct
17 Correct 64 ms 65224 KB Output is correct
18 Correct 4 ms 65224 KB Output is correct
19 Correct 17 ms 65224 KB Output is correct
20 Correct 0 ms 65224 KB Output is correct
21 Correct 30 ms 65224 KB Output is correct
22 Correct 16 ms 65224 KB Output is correct
23 Correct 14 ms 65224 KB Output is correct
24 Correct 7 ms 65224 KB Output is correct
25 Correct 8 ms 65224 KB Output is correct
26 Correct 0 ms 65224 KB Output is correct
27 Correct 43 ms 65224 KB Output is correct
28 Correct 3 ms 65224 KB Output is correct
29 Correct 39 ms 65224 KB Output is correct
30 Correct 62 ms 65224 KB Output is correct