Submission #00093


ソースコード

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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include<bits/stdc++.h>
using namespace std;
typedef struct{
int data[50];
int cnt;
}Block;
int main(){
int n;
cin>>n;
for(int i=0;i<n;i++){
Block block;
block.cnt=0;
for(int j=1;j<=30;j++){
cin>>block.data[j];
}
queue<Block>que;
que.push(block);
while(!que.empty()){
Block now=que.front();que.pop();
int num=now.data[1];
bool flag=false;
for(int j=2;j<=9&&flag==false;j++){
if(now.data[j]!=num){
flag=true;
}
}
num=now.data[10];
for(int j=11;j<=12&&flag==false;j++){
if(now.data[j]!=num){
flag=true;
}
}
num=now.data[13];
for(int j=14;j<=15&&flag==false;j++){
if(now.data[j]!=num){
flag=true;
}
}
if(flag==false){
cout<<now.cnt<<endl;
break;
}
now.cnt++;
for(int j=0;j<4;j++){
Block temp=now;
switch(j){
case 0:
swap(temp.data[1],temp.data[24]);
swap(temp.data[4],temp.data[27]);
swap(temp.data[7],temp.data[30]);
swap(temp.data[10],temp.data[21]);
swap(temp.data[16],temp.data[18]);
break;
case 1:
swap(temp.data[3],temp.data[22]);
swap(temp.data[6],temp.data[25]);
swap(temp.data[9],temp.data[28]);
swap(temp.data[12],temp.data[19]);
swap(temp.data[13],temp.data[15]);
break;
case 2:
swap(temp.data[1],temp.data[28]);
swap(temp.data[2],temp.data[29]);
swap(temp.data[3],temp.data[30]);
swap(temp.data[15],temp.data[16]);
swap(temp.data[19],temp.data[21]);
break;
case 3:
swap(temp.data[7],temp.data[22]);
swap(temp.data[8],temp.data[23]);
swap(temp.data[9],temp.data[24]);
swap(temp.data[13],temp.data[18]);
swap(temp.data[10],temp.data[12]);
}
que.push(temp);
}
}
}
return(0);
}

ステータス

項目 データ
問題 0006 - フロッピーキューブ
ユーザー名 波紋疾走
投稿日時 2017-08-23 10:05:54
言語 C++11
状態 Accepted
得点 10
ソースコード長 1805 Byte
最大実行時間 37 ms
最大メモリ使用量 18304 KB

セット

セット 得点 Cases
1 ALL 10 / 10 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
00sample.in AC 33 ms 4960 KB
1
01.in AC 17 ms 1024 KB
1
02.in AC 21 ms 1024 KB
1
03.in AC 18 ms 1764 KB
1
04.in AC 17 ms 532 KB
1
05.in AC 27 ms 1020 KB
1
06.in AC 19 ms 820 KB
1
07.in AC 20 ms 1140 KB
1
08.in AC 25 ms 5184 KB
1
09.in AC 19 ms 1260 KB
1
10.in AC 37 ms 816 KB
1
11.in AC 23 ms 4996 KB
1
12.in AC 21 ms 1792 KB
1
13.in AC 25 ms 4996 KB
1
14.in AC 24 ms 1828 KB
1
15.in AC 25 ms 1052 KB
1
16.in AC 20 ms 1276 KB
1
17.in AC 22 ms 1728 KB
1
18.in AC 21 ms 1676 KB
1
19.in AC 26 ms 1900 KB
1
20.in AC 15 ms 2000 KB
1
21.in AC 22 ms 5464 KB
1
22.in AC 30 ms 18304 KB
1
23.in AC 22 ms 2072 KB
1
24.in AC 23 ms 2200 KB
1
25.in AC 21 ms 1964 KB
1
26.in AC 21 ms 2064 KB
1
27.in AC 21 ms 2068 KB
1
28.in AC 20 ms 1892 KB
1
29.in AC 25 ms 2636 KB
1
30.in AC 25 ms 5084 KB
1