Submission #1688518
Source Code Expand
#include<bits/stdc++.h>
#define LL long long
using namespace std;
#define G(x,y,z,t) ((x)*1LL*1000000000+(y)*1000000+(z)*1000+(t))
map<LL,int> number;
struct sqare{
int x0,x1,x2,x3;
LL key[5];
void ini(int a,int b,int c,int d){
x0=a,x1=b,x2=c,x3=d;
key[1]=G(a,b,c,d);
key[2]=G(b,c,d,a);
key[3]=G(c,d,a,b);
key[4]=G(d,a,b,c);
}
void add(){
for(int i=1;i<=4;i++) number[key[i]]++;
}
void dec(){
for(int i=1;i<=4;i++) number[key[i]]--;
}
}p[505];
LL calc(sqare fr,sqare bk){
fr.dec();bk.dec();
LL ret=0;
for(int i=1;i<=4;i++){
int t=bk.x0;bk.x0=bk.x1;bk.x1=bk.x2;bk.x2=bk.x3;bk.x3=t;
LL ans=1;sqare key[5];
key[1].ini(fr.x1,fr.x0,bk.x1,bk.x0);
ans*=number[G(fr.x1,fr.x0,bk.x1,bk.x0)];key[1].dec();
key[2].ini(fr.x2,fr.x1,bk.x0,bk.x3);
ans*=number[G(fr.x2,fr.x1,bk.x0,bk.x3)];key[2].dec();
key[3].ini(fr.x3,fr.x2,bk.x3,bk.x2);
ans*=number[G(fr.x3,fr.x2,bk.x3,bk.x2)];key[3].dec();
key[4].ini(fr.x0,fr.x3,bk.x2,bk.x1);
ans*=number[G(fr.x0,fr.x3,bk.x2,bk.x1)];key[4].dec();
ret+=ans;
for(int j=1;j<=4;j++) key[j].add();
}
fr.add();bk.add();
return ret;
}
int n;
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++){
int a,b,c,d;
scanf("%d%d%d%d",&a,&b,&c,&d);
p[i].ini(a,b,c,d);
p[i].add();
}
LL ans=0;
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
if(i!=j)
ans+=calc(p[i],p[j]);
cout<<ans/6<<endl;
return 0;
}
Submission Info
Submission Time
2017-10-16 17:16:23+0900
Task
E - Building Cubes with AtCoDeer
User
Wuvin
Language
C++14 (GCC 5.4.1)
Score
0
Code Size
1433 Byte
Status
TLE
Exec Time
4221 ms
Memory
247808 KB
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:45:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&n);
^
./Main.cpp:48:32: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d%d%d",&a,&b,&c,&d);
^
Judge Result
Set Name
Sample
All
Score / Max Score
0 / 0
0 / 900
Status
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
2 ms
256 KB
0_001.txt
AC
1 ms
256 KB
0_002.txt
AC
1 ms
256 KB
1_003.txt
AC
108 ms
256 KB
1_004.txt
AC
9 ms
256 KB
1_005.txt
AC
182 ms
256 KB
1_006.txt
AC
126 ms
256 KB
1_007.txt
AC
362 ms
256 KB
1_008.txt
AC
326 ms
256 KB
1_009.txt
AC
982 ms
256 KB
1_010.txt
AC
155 ms
256 KB
1_011.txt
AC
2062 ms
896 KB
1_012.txt
AC
12 ms
640 KB
1_013.txt
TLE
4218 ms
203776 KB
1_014.txt
AC
38 ms
3584 KB
1_015.txt
TLE
4220 ms
245888 KB
1_016.txt
AC
1843 ms
88064 KB
1_017.txt
TLE
4221 ms
243200 KB
1_018.txt
TLE
4220 ms
244352 KB
1_019.txt
TLE
4220 ms
247808 KB