# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
19013 |
2016-02-17T03:21:54 Z |
kriii |
팔찌 (kriii4_V) |
C++14 |
|
481 ms |
20616 KB |
#include <stdio.h>
#include <algorithm>
using namespace std;
int N,K,A[50],B; bool chk[20000000]; long long cnt;
int enc()
{
int r = 0;
for (int i=0;i<N;i++) r = r * K + A[i];
return r;
}
void go(int a)
{
if (a == N){
if (chk[enc()]) return;
cnt++;
for (int k=0;k<2;k++){
reverse(A,A+N);
int t = enc();
for (int i=0;i<N;i++){
t = t % B * K + A[i];
chk[t] = 1;
}
}
}
else{
for (int i=0;i<K;i++){
A[a] = i;
go(a+1);
}
}
}
int main()
{
int n; scanf ("%d %d",&n,&K);
cnt = 1;
B = 1;
for (N=1;N<=n;N++) {
for (int i=0;i<B*K;i++) chk[i] = 0;
go(0);
B *= K;
}
printf ("%lld\n",cnt);
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
20616 KB |
Output is correct |
2 |
Correct |
0 ms |
20616 KB |
Output is correct |
3 |
Correct |
0 ms |
20616 KB |
Output is correct |
4 |
Correct |
0 ms |
20616 KB |
Output is correct |
5 |
Correct |
46 ms |
20616 KB |
Output is correct |
6 |
Correct |
0 ms |
20616 KB |
Output is correct |
7 |
Correct |
0 ms |
20616 KB |
Output is correct |
8 |
Correct |
0 ms |
20616 KB |
Output is correct |
9 |
Correct |
3 ms |
20616 KB |
Output is correct |
10 |
Correct |
2 ms |
20616 KB |
Output is correct |
11 |
Correct |
171 ms |
20616 KB |
Output is correct |
12 |
Correct |
0 ms |
20616 KB |
Output is correct |
13 |
Correct |
0 ms |
20616 KB |
Output is correct |
14 |
Correct |
0 ms |
20616 KB |
Output is correct |
15 |
Correct |
0 ms |
20616 KB |
Output is correct |
16 |
Correct |
0 ms |
20616 KB |
Output is correct |
17 |
Correct |
0 ms |
20616 KB |
Output is correct |
18 |
Correct |
0 ms |
20616 KB |
Output is correct |
19 |
Correct |
0 ms |
20616 KB |
Output is correct |
20 |
Correct |
481 ms |
20616 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
34 ms |
20612 KB |
SIGSEGV Segmentation fault |
2 |
Halted |
0 ms |
0 KB |
- |