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

Submission #931995

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]);
}
double 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);
mu*=(cntsq(c, tmp, f+1, s)-occ[tmp])*sym(tmp);
//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-15 22:38:46+0900 E - Building Cubes with AtCoDeer bas C++14 (GCC 5.4.1) 0 1780 Byte WA 3713 ms 256 KB

#### Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 900
Status
 AC × 3
 AC × 11 WA × 9
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 3 ms 256 KB
0_001.txt 3 ms 256 KB
0_002.txt 3 ms 256 KB
1_003.txt 1895 ms 256 KB
1_004.txt 51 ms 256 KB
1_005.txt 2991 ms 256 KB
1_006.txt 1798 ms 256 KB
1_007.txt 3713 ms 256 KB
1_008.txt 3156 ms 256 KB
1_009.txt 3581 ms 256 KB
1_010.txt 217 ms 256 KB
1_011.txt 3264 ms 256 KB
1_012.txt 6 ms 256 KB
1_013.txt 2842 ms 256 KB
1_014.txt 9 ms 256 KB
1_015.txt 2791 ms 256 KB
1_016.txt 450 ms 256 KB
1_017.txt 2792 ms 256 KB
1_018.txt 2792 ms 256 KB
1_019.txt 2798 ms 256 KB