Contest Duration: - (local time) (100 minutes) Back to Home

Submission #932744

Source Code Expand

Copy
```#include<iostream>
#include<vector>
#include<set>
#include<map>
#include <utility>
#include <cstdio>
#include<algorithm>
#include<queue>
#define ll  long long

using namespace std;
int n;
void rotate(vector<int> & vec){
vector<int> tmp(4);
int minind = min_element(vec.begin(), vec.end() ) - vec.begin();
for(int i=3; i>0; i--){
if(vec[i]==vec[minind]){
minind=i;
}else{
break;
}
}
for(int i=0; i<4; i++){
tmp[i] = vec[(i+minind)%4];
}
vec=tmp;
}
void rot1(vector<int> & vec){
int tmp = vec[0];
for(int i=0; i<4; i++){
vec[i] = vec[i+1];
}
vec[3]=tmp;
}
int cntsq(vector<vector<int> > & c, vector<int>  & sq, int st, int sk){
int res=0;
for(int i=st; i<n; i++)
if(i!=sk && c[i]==sq)res++;
return res;
}
int sym(vector<int> v){
if(v[0]!=v[2] || v[1]!=v[3])return 1;
if(v[0]!=v[1] || v[2]!=v[3])return 2;
return 4;
}
int main(){
cin>>n;
vector<vector<int> > c(n, vector<int>(4));
for(int i=0; i<n; i++){
for(int j=0; j<4; j++ )cin>>c[i][j];
rotate(c[i]);
}
ll res = 0;
for(int f = 0; f<n; f++){
for(int s=f+1; s<n; s++){
for(int r=0; r<4; r++){
unsigned ll mu=1;
map<vector<int>, int> occ; occ.clear();
for(int i=0; i<4; i++){
vector<int> tmp(4);
tmp[1] = c[f][i]; tmp[0] = c[f][(i+1)%4];
tmp[3] = c[s][3-(i+1)%4]; tmp[2] = c[s][3-i];
rotate(tmp);
int x = cntsq(c, tmp, f+1, s);
if(x)
mu*=1LL*(x-occ[tmp])*sym(tmp);
else {mu=0; break; }
//cout<<f<<" "<<s<<" "<<r<<" "<<i<<" "<<cntsq(c, tmp, f+1, s)<<" "<<mu<<"\n";
//cout<<tmp[0]<<tmp[1]<<tmp[2]<<tmp[3]<<"\n";
occ[tmp]++;
}
res+=mu;
rot1(c[s]);
//		cout<<c[s][0]<<c[s][1]<<c[s][2]<<c[s][3]<<"\n";
}
}
}
cout<<res;
}```

#### Submission Info

Submission Time 2016-10-16 02:23:18+0900 E - Building Cubes with AtCoDeer bas C++14 (GCC 5.4.1) 0 1836 Byte WA 3641 ms 384 KB

#### Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 900
Status
 AC × 3
 AC × 15 WA × 5
Set Name Test Cases
Sample 0_000.txt, 0_001.txt, 0_002.txt
All 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt
Case Name Status Exec Time Memory
0_000.txt AC 3 ms 256 KB
0_001.txt AC 3 ms 256 KB
0_002.txt AC 3 ms 256 KB
1_003.txt AC 1891 ms 256 KB
1_004.txt AC 53 ms 256 KB
1_005.txt AC 3004 ms 256 KB
1_006.txt AC 1789 ms 256 KB
1_007.txt WA 3641 ms 256 KB
1_008.txt WA 3042 ms 256 KB
1_009.txt WA 2633 ms 256 KB
1_010.txt WA 96 ms 256 KB
1_011.txt WA 861 ms 256 KB
1_012.txt AC 3 ms 256 KB
1_013.txt AC 661 ms 256 KB
1_014.txt AC 4 ms 256 KB
1_015.txt AC 645 ms 256 KB
1_016.txt AC 100 ms 256 KB
1_017.txt AC 645 ms 256 KB
1_018.txt AC 650 ms 256 KB
1_019.txt AC 657 ms 384 KB